feat: Add Installation onboarding flow (#1640)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Sojan Jose
2021-01-17 14:07:18 +05:30
committed by GitHub
parent a5c3c4301c
commit 14eefe3824
12 changed files with 250 additions and 39 deletions

View File

@@ -1,5 +1,5 @@
class ChatwootHub
BASE_URL = 'https://hub.chatwoot.com'.freeze
BASE_URL = ENV['CHATWOOT_HUB_URL'] || 'https://hub.chatwoot.com'
def self.instance_config
{
@@ -19,4 +19,12 @@ class ChatwootHub
end
version
end
def self.register_instance(info)
RestClient.post("#{BASE_URL}/register_instance", info.merge(instance_config).to_json, { content_type: :json, accept: :json })
rescue *ExceptionList::REST_CLIENT_EXCEPTIONS, *ExceptionList::URI_EXCEPTIONS => e
Rails.logger.info "Exception: #{e.message}"
rescue StandardError => e
Raven.capture_exception(e)
end
end

View File

@@ -27,5 +27,6 @@ module Redis::RedisKeys
REAUTHORIZATION_REQUIRED = 'REAUTHORIZATION_REQUIRED:%<obj_type>s:%<obj_id>d'.freeze
## Internal Installation related keys
CHATWOOT_INSTALLATION_ONBOARDING = 'CHATWOOT_INSTALLATION_ONBOARDING'.freeze
LATEST_CHATWOOT_VERSION = 'LATEST_CHATWOOT_VERSION'.freeze
end