diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..2ba9a84 --- /dev/null +++ b/.env.template @@ -0,0 +1,2 @@ +DATABASE_USERNAME=username +DATABASE_PASSWORD=password diff --git a/.gitignore b/.gitignore index 4aaf102..4fb82d9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ # Ignore all environment files (except templates). /.env* !/.env*.erb +!/.env.template # Ignore all logfiles and tempfiles. /log/* diff --git a/Gemfile b/Gemfile index 1b142a1..a22e970 100644 --- a/Gemfile +++ b/Gemfile @@ -68,3 +68,5 @@ gem "bcrypt", "~> 3.1.7" gem "bootstrap" # SassC-rails for integrating Sass with Rails gem "sassc-rails" + +gem "dotenv-rails", groups: [ :development, :test, :production ] diff --git a/Gemfile.lock b/Gemfile.lock index 8417f74..91ca1a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -105,6 +105,10 @@ GEM debug (1.9.2) irb (~> 1.10) reline (>= 0.3.8) + dotenv (3.1.2) + dotenv-rails (3.1.2) + dotenv (= 3.1.2) + railties (>= 6.1) drb (2.2.1) erubi (1.13.0) execjs (2.9.1) @@ -324,6 +328,7 @@ DEPENDENCIES brakeman capybara debug + dotenv-rails importmap-rails jbuilder pg (~> 1.1) diff --git a/config/database.yml b/config/database.yml index af03c46..69e9591 100644 --- a/config/database.yml +++ b/config/database.yml @@ -13,12 +13,14 @@ # gem "pg" # default: &default + adapter: postgresql encoding: unicode # For details on connection pooling, see Rails configuration guide # https://guides.rubyonrails.org/configuring.html#database-pooling pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - + username: <%= ENV['DATABASE_USERNAME'] %> + password: <%= ENV['DATABASE_PASSWORD'] %> development: <<: *default @@ -81,5 +83,5 @@ test: production: <<: *default database: pet_register_production - username: pet_register - password: <%= ENV["PET_REGISTER_DATABASE_PASSWORD"] %> + username: <%= ENV['DATABASE_USERNAME'] %> + password: <%= ENV['DATABASE_PASSWORD'] %> diff --git a/config/environments/development.rb b/config/environments/development.rb index d088221..6a847e0 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -4,6 +4,10 @@ # Settings specified here will take precedence over those in config/application.rb. config.action_controller.default_url_options = { host: "localhost:3000", port: 3000 } config.hosts << "localhost" + config.hosts << "pet-tag-generator.sarahjobs.com" + config.hosts << "sarahjobs.com" + config.hosts << /.*\.sarahjobs\.com/ + # In the development environment your application's code is reloaded any time # it changes. This slows down response time but is perfect for development diff --git a/config/environments/production.rb b/config/environments/production.rb index 9be5c00..bff671e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -2,6 +2,11 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. + config.action_controller.default_url_options = { host: "localhost:3000", port: 3000 } + config.hosts << "localhost" + config.hosts << "pet-tag-generator.sarahjobs.com" + config.hosts << "sarahjobs.com" + config.hosts << /.*\.sarahjobs\.com/ # Code is not reloaded between requests. config.enable_reloading = false