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

@@ -76,4 +76,13 @@ Rails.application.configure do
Bullet.bullet_logger = true
Bullet.rails_logger = true
end
# ref: https://github.com/cyu/rack-cors
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/packs/*', headers: :any, methods: [:get, :options]
resource '*', headers: :any, methods: :any, expose: ['access-token', 'client', 'uid', 'expiry']
end
end
end

View File

@@ -110,10 +110,14 @@ Rails.application.configure do
# font cors issue with CDN
# Ref: https://stackoverflow.com/questions/56960709/rails-font-cors-policy
# ref: https://github.com/cyu/rack-cors
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/packs/*', headers: :any, methods: [:get, :options]
if ActiveModel::Type::Boolean.new.cast(ENV.fetch('CW_API_ONLY_SERVER', false))
resource '*', headers: :any, methods: :any, expose: ['access-token', 'client', 'uid', 'expiry']
end
end
end
end