From c2e09091325cd007eeb0bb6e6ec00430b47a774b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Tue, 14 Feb 2023 13:16:10 +0800 Subject: [PATCH] Use plain hash for ENV vars --- config/database.yml | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/config/database.yml b/config/database.yml index bac8f50..7f9bef7 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,12 +1,6 @@ -# SQLite. Versions 3.8.0 and up are supported. -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -# default: &default adapter: sqlite3 - pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %> timeout: 5000 development: @@ -17,11 +11,11 @@ development: <<: *default adapter: postgresql database_tasks: false - host: <%= ENV.fetch("LNDHUB_PG_HOST") { 'localhost' } %> - port: <%= ENV.fetch("LNDHUB_PG_PORT") { 5432 } %> - database: <%= ENV.fetch("LNDHUB_PG_DATABASE") { 'lndhub' } %> - username: <%= ENV.fetch("LNDHUB_PG_USERNAME") { 'lndhub' } %> - password: <%= ENV.fetch("LNDHUB_PG_PASSWORD") %> + host: <%= ENV["LNDHUB_PG_HOST"] || 'localhost' %> + port: <%= ENV["LNDHUB_PG_PORT"] || 5432 %> + database: <%= ENV["LNDHUB_PG_DATABASE"] || 'lndhub' %> + username: <%= ENV["LNDHUB_PG_USERNAME"] || 'lndhub' %> + password: <%= ENV["LNDHUB_PG_PASSWORD"] %> # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". @@ -48,8 +42,8 @@ production: <<: *default adapter: postgresql database_tasks: false - host: <%= ENV.fetch("LNDHUB_PG_HOST") { 'localhost' } %> - port: <%= ENV.fetch("LNDHUB_PG_PORT") { 5432 } %> - database: <%= ENV.fetch("LNDHUB_PG_DATABASE") { 'lndhub' } %> - username: <%= ENV.fetch("LNDHUB_PG_USERNAME") { 'lndhub' } %> - password: <%= ENV.fetch("LNDHUB_PG_PASSWORD") %> + host: <%= ENV["LNDHUB_PG_HOST"] || 'localhost' %> + port: <%= ENV["LNDHUB_PG_PORT"] || 5432 %> + database: <%= ENV["LNDHUB_PG_DATABASE"] || 'lndhub' %> + username: <%= ENV["LNDHUB_PG_USERNAME"] || 'lndhub' %> + password: <%= ENV["LNDHUB_PG_PASSWORD"] %>