Sha256: 05a59f9f76ae44f327b663f441809a54b2e2378d5b0a20d471fa05d1168c09d5

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

require 'sidekiq/web'

DiscoApp::Engine.routes.draw do

  get 'ref', to: '/sessions#referral'

  controller :webhooks do
    post 'webhooks' => :process_webhook, as: :webhooks
  end

  resources :subscriptions, only: [:new, :create] do
    resources :charges, only: [:new, :create] do
      member do
        get 'activate'
      end
    end
  end

  controller :install do
    get 'install' => :install, as: :install
    get 'installing' => :installing, as: :installing
    get 'uninstalling' => :uninstalling, as: :uninstalling
  end

  controller 'admin' do
    get 'admin', to: redirect('/admin/shops')
    get 'admin/shops' => 'admin/shops#index'
  end

  namespace :admin do
    resources :shops, only: [:index, :edit, :update] do
      resources :subscriptions, only: [:edit, :update]
    end
    resources :plans
    resource :app_settings, only: [:edit, :update]

    # JSON-API resources for admins.
    namespace :resources do
      jsonapi_resources :shops
    end
  end

  # Make the Sidekiq Web UI accessible using the same credentials as the admin.
  if Rails.env.production?
    Sidekiq::Web.use Rack::Auth::Basic do |username, password|
      [
        ENV['ADMIN_APP_USERNAME'].present?,
        username == ENV['ADMIN_APP_USERNAME'] == username,
        ENV['ADMIN_APP_PASSWORD'].present?,
        password == ENV['ADMIN_APP_PASSWORD'] == username,
      ].all?
    end
    mount Sidekiq::Web, at: '/sidekiq'
  end

  # Make the embedded app frame emulator available in development.
  if Rails.env.development?
    controller :frame do
      get 'frame' => :frame, as: :frame
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
disco_app-0.10.2 config/routes.rb