Chore: Housekeeping tasks (#721)
- End point to return api version - Move agent bot listener to sync dispatcher - gem update
This commit is contained in:
parent
55892e37f9
commit
743bddc065
8 changed files with 59 additions and 18 deletions
32
Gemfile.lock
32
Gemfile.lock
|
@ -82,10 +82,10 @@ GEM
|
|||
rake (>= 10.4, < 14.0)
|
||||
ast (2.4.0)
|
||||
attr_extras (6.2.3)
|
||||
aws-eventstream (1.0.3)
|
||||
aws-partitions (1.294.0)
|
||||
aws-sdk-core (3.92.0)
|
||||
aws-eventstream (~> 1.0, >= 1.0.2)
|
||||
aws-eventstream (1.1.0)
|
||||
aws-partitions (1.296.0)
|
||||
aws-sdk-core (3.94.0)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
aws-partitions (~> 1, >= 1.239.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
jmespath (~> 1.0)
|
||||
|
@ -113,7 +113,7 @@ GEM
|
|||
bindex (0.8.1)
|
||||
bootsnap (1.4.6)
|
||||
msgpack (~> 1.0)
|
||||
brakeman (4.8.0)
|
||||
brakeman (4.8.1)
|
||||
browser (4.0.0)
|
||||
builder (3.2.4)
|
||||
bullet (6.1.0)
|
||||
|
@ -179,7 +179,7 @@ GEM
|
|||
foreman (0.87.1)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
google-api-client (0.37.2)
|
||||
google-api-client (0.38.0)
|
||||
addressable (~> 2.5, >= 2.5.1)
|
||||
googleauth (~> 0.9)
|
||||
httpclient (>= 2.8.1, < 3.0)
|
||||
|
@ -193,20 +193,20 @@ GEM
|
|||
google-cloud-env (1.3.1)
|
||||
faraday (>= 0.17.3, < 2.0)
|
||||
google-cloud-errors (1.0.0)
|
||||
google-cloud-storage (1.25.1)
|
||||
google-cloud-storage (1.26.0)
|
||||
addressable (~> 2.5)
|
||||
digest-crc (~> 0.4)
|
||||
google-api-client (~> 0.33)
|
||||
google-cloud-core (~> 1.2)
|
||||
googleauth (~> 0.9)
|
||||
mini_mime (~> 1.0)
|
||||
googleauth (0.11.0)
|
||||
googleauth (0.12.0)
|
||||
faraday (>= 0.17.3, < 2.0)
|
||||
jwt (>= 1.4, < 3.0)
|
||||
memoist (~> 0.16)
|
||||
multi_json (~> 1.11)
|
||||
os (>= 0.9, < 2.0)
|
||||
signet (~> 0.12)
|
||||
signet (~> 0.14)
|
||||
groupdate (5.0.0)
|
||||
activesupport (>= 5)
|
||||
haikunator (1.1.0)
|
||||
|
@ -253,7 +253,7 @@ GEM
|
|||
listen (3.2.1)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
loofah (2.4.0)
|
||||
loofah (2.5.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
|
@ -284,21 +284,21 @@ GEM
|
|||
orm_adapter (0.5.0)
|
||||
os (1.1.0)
|
||||
parallel (1.19.1)
|
||||
parser (2.7.1.0)
|
||||
parser (2.7.1.1)
|
||||
ast (~> 2.4.0)
|
||||
pg (1.2.3)
|
||||
pry (0.13.0)
|
||||
pry (0.13.1)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
pry-rails (0.3.9)
|
||||
pry (>= 0.10.4)
|
||||
public_suffix (4.0.3)
|
||||
public_suffix (4.0.4)
|
||||
puma (4.3.3)
|
||||
nio4r (~> 2.0)
|
||||
pundit (2.1.0)
|
||||
activesupport (>= 3.0.0)
|
||||
rack (2.2.2)
|
||||
rack-cache (1.11.0)
|
||||
rack-cache (1.11.1)
|
||||
rack (>= 0.4)
|
||||
rack-cors (1.1.1)
|
||||
rack (>= 2.0.0)
|
||||
|
@ -388,7 +388,7 @@ GEM
|
|||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-performance (1.5.2)
|
||||
rubocop (>= 0.71.0)
|
||||
rubocop-rails (2.5.1)
|
||||
rubocop-rails (2.5.2)
|
||||
activesupport
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 0.72.0)
|
||||
|
@ -463,7 +463,7 @@ GEM
|
|||
unf_ext (0.0.7.7)
|
||||
unicode-display_width (1.7.0)
|
||||
uniform_notifier (1.13.0)
|
||||
valid_email2 (3.2.1)
|
||||
valid_email2 (3.2.2)
|
||||
activemodel (>= 3.2)
|
||||
mail (~> 2.5)
|
||||
virtus (1.0.5)
|
||||
|
|
8
app/controllers/api_controller.rb
Normal file
8
app/controllers/api_controller.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class ApiController < ApplicationController
|
||||
skip_before_action :set_current_user, only: [:index]
|
||||
skip_before_action :check_subscription, only: [:index]
|
||||
|
||||
def index
|
||||
render json: { version: Chatwoot.config[:version], timestamp: Time.now.utc.to_formatted_s(:db) }
|
||||
end
|
||||
end
|
|
@ -9,7 +9,7 @@ class AsyncDispatcher < BaseDispatcher
|
|||
end
|
||||
|
||||
def listeners
|
||||
listeners = [AgentBotListener.instance, EmailNotificationListener.instance, ReportingListener.instance, WebhookListener.instance]
|
||||
listeners = [EmailNotificationListener.instance, ReportingListener.instance, WebhookListener.instance]
|
||||
listeners << EventListener.instance
|
||||
listeners << SubscriptionListener.instance if ENV['BILLING_ENABLED']
|
||||
listeners
|
||||
|
|
|
@ -5,6 +5,6 @@ class SyncDispatcher < BaseDispatcher
|
|||
end
|
||||
|
||||
def listeners
|
||||
[ActionCableListener.instance]
|
||||
[ActionCableListener.instance, AgentBotListener.instance]
|
||||
end
|
||||
end
|
||||
|
|
14
config/app.yml
Normal file
14
config/app.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
shared: &shared
|
||||
version: '1.4.0'
|
||||
|
||||
development:
|
||||
<<: *shared
|
||||
|
||||
production:
|
||||
<<: *shared
|
||||
|
||||
staging:
|
||||
<<: *shared
|
||||
|
||||
test:
|
||||
<<: *shared
|
|
@ -30,5 +30,12 @@ module Chatwoot
|
|||
config.action_dispatch.default_headers = {
|
||||
'X-Frame-Options' => 'ALLOWALL'
|
||||
}
|
||||
|
||||
# Custom chatwoot configurations
|
||||
config.x = config_for(:app).with_indifferent_access
|
||||
end
|
||||
|
||||
def self.config
|
||||
@config ||= Rails.configuration.x
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,6 +17,7 @@ Rails.application.routes.draw do
|
|||
|
||||
resource :widget, only: [:show]
|
||||
|
||||
get '/api', to: 'api#index'
|
||||
namespace :api, defaults: { format: 'json' } do
|
||||
namespace :v1 do
|
||||
# ----------------------------------
|
||||
|
|
11
spec/controllers/api_controller_spec.rb
Normal file
11
spec/controllers/api_controller_spec.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'API Base', type: :request do
|
||||
describe 'request to api base url' do
|
||||
it 'returns api version' do
|
||||
get '/api/'
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include(Chatwoot.config[:version])
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue