chore: ability to run Chatwoot as API only server (#2344)

- Ability to run chatwoot as an API only server
- Removes action cable testing gem since it is merged to rails 6
This commit is contained in:
Sojan Jose
2021-05-27 20:07:21 +05:30
committed by GitHub
parent 9c555e70c9
commit 3b39eb3e33
8 changed files with 44 additions and 11 deletions

View File

@@ -8,14 +8,19 @@ Rails.application.routes.draw do
token_validations: 'devise_overrides/token_validations'
}, via: [:get, :post]
root to: 'dashboard#index'
## renders the frontend paths only if its not an api only server
if ActiveModel::Type::Boolean.new.cast(ENV.fetch('CW_API_ONLY_SERVER', false))
root to: 'api#index'
else
root to: 'dashboard#index'
get '/app', to: 'dashboard#index'
get '/app/*params', to: 'dashboard#index'
get '/app/accounts/:account_id/settings/inboxes/new/twitter', to: 'dashboard#index', as: 'app_new_twitter_inbox'
get '/app/accounts/:account_id/settings/inboxes/new/:inbox_id/agents', to: 'dashboard#index', as: 'app_twitter_inbox_agents'
get '/app', to: 'dashboard#index'
get '/app/*params', to: 'dashboard#index'
get '/app/accounts/:account_id/settings/inboxes/new/twitter', to: 'dashboard#index', as: 'app_new_twitter_inbox'
get '/app/accounts/:account_id/settings/inboxes/new/:inbox_id/agents', to: 'dashboard#index', as: 'app_twitter_inbox_agents'
resource :widget, only: [:show]
resource :widget, only: [:show]
end
get '/api', to: 'api#index'
namespace :api, defaults: { format: 'json' } do