Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save adrianvalenz/59cbcfa9f8d0299bdf079eee7ab687d3 to your computer and use it in GitHub Desktop.
Save adrianvalenz/59cbcfa9f8d0299bdf079eee7ab687d3 to your computer and use it in GitHub Desktop.
Rails secret && database yaml files
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# 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
staging:
<<: *default
adapter: postgresql
host: localhost
database: appname_staging
username: appname_user
password: th3f1r3w1th1n
encoding: utf8
production:
<<: *default
adapter: postgresql
host: localhost
database: appname_production
username: appname_user
password: th3f1r3w1th1n
encoding: utf8
# make postgresql database on server
sudo su - postgres
psql
CREATE DATABASE appname_production;
CREATE USER appname_user WITH PASSWORD 'th3f1r3w1th1n';
GRANT ALL PRIVILEGES ON DATABASE appname_production TO appname_user;
\q
exit
# generate secret in local project root for production
rake secret
staging:
asd;lfjkasdjlf
production:
asldfjkas;ldfjkas;ldfjkasjkdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment