From 387020ff901b3a98948098ab79daf1859a5617f3 Mon Sep 17 00:00:00 2001 From: takahashim Date: Mon, 21 Feb 2022 21:12:22 +0900 Subject: [PATCH] Allow to change DB name in dev/test --- config/database.yml | 4 ++-- docs/DEVELOPMENT.md | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config/database.yml b/config/database.yml index 37621dbe54..e144b164f4 100644 --- a/config/database.yml +++ b/config/database.yml @@ -29,7 +29,7 @@ default: &default development: <<: *default - database: decidim-app_development + database: <%= ENV.fetch("DATABASE_DBNAME_DEV") { "decidim-app_development" } %> # The specified database role being used to connect to postgres. # To create additional roles in postgres see `$ createuser --help`. @@ -63,7 +63,7 @@ development: # Do not set this db to the same as development or production. test: <<: *default - database: decidim-app_test + database: <%= ENV.fetch("DATABASE_DBNAME_TEST") { "decidim-app_test" } %> # As with config/secrets.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index fb2e9e0ae0..c4968dd27a 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -44,6 +44,14 @@ export DATABASE_USERNAME= export DATABASE_PASSWORD= ``` +なお、DBのhost、port、DB名も設定したい場合は、以下のように環境変数を指定します。 + +``` +export DATABASE_HOST= +export DATABASE_PORT= +export DATABASE_DBNAME_DEV= +``` + ### 2.6 bundle install ``` bundle install