Skip to content

Commit

Permalink
feat: updates database for handle credential from .env files, adds do…
Browse files Browse the repository at this point in the history
…ten package, adds hosts allowed
  • Loading branch information
sarahcssiqueira committed Sep 10, 2024
1 parent 7b3a6f3 commit e98aa10
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DATABASE_USERNAME=username
DATABASE_PASSWORD=password
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# Ignore all environment files (except templates).
/.env*
!/.env*.erb
!/.env.template

# Ignore all logfiles and tempfiles.
/log/*
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -324,6 +328,7 @@ DEPENDENCIES
brakeman
capybara
debug
dotenv-rails
importmap-rails
jbuilder
pg (~> 1.1)
Expand Down
8 changes: 5 additions & 3 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'] %>
4 changes: 4 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e98aa10

Please sign in to comment.