feat: include installation method in data to cw hub (#2831)

This commit is contained in:
Vishnu Narayanan 2021-08-16 23:35:00 +05:30 committed by GitHub
parent 0e4196c91a
commit 319412f6dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 1 deletions

View file

@ -28,6 +28,10 @@
"FRONTEND_URL": { "FRONTEND_URL": {
"description": "Public root URL of the Chatwoot installation. This will be used in the emails.", "description": "Public root URL of the Chatwoot installation. This will be used in the emails.",
"value": "https://CHANGE.herokuapp.com" "value": "https://CHANGE.herokuapp.com"
},
"INSTALLATION_ENV": {
"description": "Installation method used for Chatwoot.",
"value": "heroku"
} }
}, },
"formation": { "formation": {

View file

@ -63,6 +63,7 @@ sed -i -e '/POSTGRES_HOST/ s/=.*/=localhost/' .env
sed -i -e '/POSTGRES_USERNAME/ s/=.*/=chatwoot/' .env sed -i -e '/POSTGRES_USERNAME/ s/=.*/=chatwoot/' .env
sed -i -e "/POSTGRES_PASSWORD/ s/=.*/=$pg_pass/" .env sed -i -e "/POSTGRES_PASSWORD/ s/=.*/=$pg_pass/" .env
sed -i -e '/RAILS_ENV/ s/=.*/=$RAILS_ENV/' .env sed -i -e '/RAILS_ENV/ s/=.*/=$RAILS_ENV/' .env
echo -en "\nINSTALLATION_ENV=LINUX_SCRIPT" >> ".env"
RAILS_ENV=production bundle exec rake db:create RAILS_ENV=production bundle exec rake db:create
RAILS_ENV=production bundle exec rake db:reset RAILS_ENV=production bundle exec rake db:reset

View file

@ -70,6 +70,7 @@ sed -i -e '/POSTGRES_HOST/ s/=.*/=localhost/' .env
sed -i -e '/POSTGRES_USERNAME/ s/=.*/=chatwoot/' .env sed -i -e '/POSTGRES_USERNAME/ s/=.*/=chatwoot/' .env
sed -i -e "/POSTGRES_PASSWORD/ s/=.*/=$pg_pass/" .env sed -i -e "/POSTGRES_PASSWORD/ s/=.*/=$pg_pass/" .env
sed -i -e '/RAILS_ENV/ s/=.*/=$RAILS_ENV/' .env sed -i -e '/RAILS_ENV/ s/=.*/=$RAILS_ENV/' .env
echo -en "\nINSTALLATION_ENV=LINUX_SCRIPT" >> ".env"
RAILS_ENV=production bundle exec rake db:create RAILS_ENV=production bundle exec rake db:create
RAILS_ENV=production bundle exec rake db:reset RAILS_ENV=production bundle exec rake db:reset

View file

@ -15,6 +15,7 @@ services:
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- RAILS_ENV=production - RAILS_ENV=production
- INSTALLATION_ENV=docker
entrypoint: docker/entrypoints/rails.sh entrypoint: docker/entrypoints/rails.sh
command: ['bundle', 'exec', 'rails', 's', '-p', '3000', '-b', '0.0.0.0'] command: ['bundle', 'exec', 'rails', 's', '-p', '3000', '-b', '0.0.0.0']
@ -26,6 +27,7 @@ services:
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- RAILS_ENV=production - RAILS_ENV=production
- INSTALLATION_ENV=docker
command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml'] command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml']
postgres: postgres:

View file

@ -14,7 +14,8 @@ class ChatwootHub
{ {
installation_identifier: installation_identifier, installation_identifier: installation_identifier,
installation_version: Chatwoot.config[:version], installation_version: Chatwoot.config[:version],
installation_host: URI.parse(ENV.fetch('FRONTEND_URL', '')).host installation_host: URI.parse(ENV.fetch('FRONTEND_URL', '')).host,
installation_env: ENV.fetch('INSTALLATION_ENV', '')
} }
end end