]> cat aescling's git repositories - mastodon.git/commitdiff
Fix mastodon:setup not running properly when some environment variables are set ...
authorThibG <thib@sitedethib.com>
Tue, 2 Jun 2020 11:57:21 +0000 (13:57 +0200)
committerGitHub <noreply@github.com>
Tue, 2 Jun 2020 11:57:21 +0000 (13:57 +0200)
When using one of the docker-compose containers, mastodon:setup will use the
existing .env.production rather than the generated one during the setup steps.

This is because dotenv does not overwrite env variables that are alreayd
defined, and the docker-compose.yml file loads the environment variables
from .env.production.

lib/tasks/mastodon.rake

index a873335d40571b56a34ecc87bd9b3f7666062289..a41080a63fb5f7886127806b3b787268df1b8ef0 100644 (file)
@@ -367,7 +367,7 @@ namespace :mastodon do
           prompt.say 'Running `RAILS_ENV=production rails db:setup` ...'
           prompt.say "\n\n"
 
-          if cmd.run!({ RAILS_ENV: 'production', SAFETY_ASSURED: 1 }, :rails, 'db:setup').failure?
+          if cmd.run!(env.merge({ RAILS_ENV: 'production', SAFETY_ASSURED: 1 }), :rails, 'db:setup').failure?
             prompt.error 'That failed! Perhaps your configuration is not right'
           else
             prompt.ok 'Done!'
@@ -382,7 +382,7 @@ namespace :mastodon do
           prompt.say 'Running `RAILS_ENV=production rails assets:precompile` ...'
           prompt.say "\n\n"
 
-          if cmd.run!({ RAILS_ENV: 'production' }, :rails, 'assets:precompile').failure?
+          if cmd.run!(env.merge({ RAILS_ENV: 'production' }), :rails, 'assets:precompile').failure?
             prompt.error 'That failed! Maybe you need swap space?'
           else
             prompt.say 'Done!'