about summary refs log tree commit diff
path: root/config
diff options
context:
space:
mode:
authorsasanquaneuf <sasanquaneuf@gmail.com>2022-02-25 09:16:52 +0900
committerGitHub <noreply@github.com>2022-02-25 01:16:52 +0100
commit21e80a979253e4c98fd8852c93c6069028c184f6 (patch)
tree901eb32582461c28371cacc82761f27a4f27deae /config
parent2cd31b31778cec3b282a44f03a03844d92a4e8cc (diff)
Escape database passwords in config/database.yml (#17627)
* Add double quotes for using passwords that start with a comma

* Escape database password in yml
Diffstat (limited to 'config')
-rw-r--r--config/database.yml6
1 files changed, 3 insertions, 3 deletions
diff --git a/config/database.yml b/config/database.yml
index c10bff6b2..9b8d096e9 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -9,7 +9,7 @@ development:
   <<: *default
   database: <%= ENV['DB_NAME'] || 'mastodon_development' %>
   username: <%= ENV['DB_USER'] %>
-  password: <%= ENV['DB_PASS'] %>
+  password: <%= (ENV['DB_PASS'] || '').to_json %>
   host: <%= ENV['DB_HOST'] %>
   port: <%= ENV['DB_PORT'] %>
 
@@ -20,7 +20,7 @@ test:
   <<: *default
   database: <%= ENV['DB_NAME'] || 'mastodon' %>_test<%= ENV['TEST_ENV_NUMBER'] %>
   username: <%= ENV['DB_USER'] %>
-  password: <%= ENV['DB_PASS'] %>
+  password: <%= (ENV['DB_PASS'] || '').to_json %>
   host: <%= ENV['DB_HOST'] %>
   port: <%= ENV['DB_PORT'] %>
 
@@ -28,7 +28,7 @@ production:
   <<: *default
   database: <%= ENV['DB_NAME'] || 'mastodon_production' %>
   username: <%= ENV['DB_USER'] || 'mastodon' %>
-  password: <%= ENV['DB_PASS'] || '' %>
+  password: <%= (ENV['DB_PASS'] || '').to_json %>
   host: <%= ENV['DB_HOST'] || 'localhost' %>
   port: <%= ENV['DB_PORT'] || 5432 %>
   prepared_statements: <%= ENV['PREPARED_STATEMENTS'] || 'true' %>