Skip to content
This repository has been archived by the owner on Apr 21, 2021. It is now read-only.

Commit

Permalink
postgres setup via dotenv
Browse files Browse the repository at this point in the history
  • Loading branch information
pacharanero committed Nov 7, 2018
1 parent 0b11dc4 commit 28219a5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
Expand All @@ -25,3 +21,6 @@

# Ignore master key for decrypting credentials and more.
/config/master.key

# Ignore environment files
.env
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gem 'rails', '~> 5.2.1'
gem 'puma', '~> 3.11'
gem 'pg'
gem 'bootsnap', '>= 1.1.0', require: false

gem 'dotenv-rails'
gem 'distribution'

group :development, :test do
Expand Down
7 changes: 6 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ GEM
concurrent-ruby (1.0.5)
crass (1.0.4)
distribution (0.7.3)
dotenv (2.5.0)
dotenv-rails (2.5.0)
dotenv (= 2.5.0)
railties (>= 3.2, < 6.0)
erubi (1.7.1)
ffi (1.9.25)
globalid (0.4.1)
Expand Down Expand Up @@ -137,6 +141,7 @@ DEPENDENCIES
bootsnap (>= 1.1.0)
byebug
distribution
dotenv-rails
listen (>= 3.0.5, < 3.2)
pg
puma (~> 3.11)
Expand All @@ -149,4 +154,4 @@ RUBY VERSION
ruby 2.5.1p57

BUNDLED WITH
1.16.5
1.17.1
26 changes: 12 additions & 14 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# SQLite version 3.x
# 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 } %>
adapter: postgresql
encoding: unicode
username: <%= ENV['POSTGRES_USER'] %>
password: <%= ENV['POSTGRES_PASSWORD'] %>
pool: 5
timeout: 5000
host: <%= ENV['POSTGRES_HOST'] %>

development:
<<: *default
database: db/development.sqlite3
database: <%= ENV['POSTGRES_DEV_DB'] %>
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
database: <%= ENV['POSTGRES_TEST_DB'] %>

production:
<<: *default
database: db/production.sqlite3
database: <%= ENV['POSTGRES_LIVE_DB'] %>

0 comments on commit 28219a5

Please sign in to comment.