Skip to content

Commit

Permalink
Update how we store env variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
zackgilbert committed Jul 23, 2018
1 parent 42244f0 commit 2bc3746
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
/db/*.sqlite3

# Ignore all logfiles and tempfiles.
.DS_Store
package-lock.json
/log/*.log.*
/log/*.log
/tmp
/config/app_environment_variables.rb
vendor/.DS_Store
vendor/bundle/
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.0.0-p648
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rollbar (2.16.2)
rollbar (2.16.3)
multi_json
rubyzip (1.2.1)
sass (3.2.14)
Expand All @@ -204,7 +204,7 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sshkit (1.16.1)
sshkit (1.17.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
therubyracer (0.12.3)
Expand All @@ -221,7 +221,7 @@ GEM
rack-accept (~> 0.4)
tilt (>= 1.4, < 3)
tzinfo (0.3.54)
uglifier (4.1.14)
uglifier (4.1.16)
execjs (>= 0.3.0, < 3)
underscore-rails (1.8.3)
unf (0.1.4)
Expand Down Expand Up @@ -275,4 +275,4 @@ DEPENDENCIES
yaml_db

BUNDLED WITH
1.16.2
1.16.3
18 changes: 9 additions & 9 deletions config/application.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
defaults: &defaults

development:
app_id: "REPLACE_ME"
app_secret: "REPLACE_ME"
callback_url: "http://localhost:3000/session/callback"
aws_key: "REPLACE_ME"
aws_secret: "REPLACE_ME"
cloudwatch_key: "REPLACE_ME"
cloudwatch_secret: "REPLACE_ME"
google_maps_key: "REPLACE_ME"
s3_bucket: "REPLACE_ME"
app_id: "<%= ENV['FOURSQUARE_CLIENT_ID'] %>"
app_secret: "<%= ENV['FOURSQUARE_CLIENT_SECRET'] %>"
callback_url: "<%= ENV['OAUTH_CALLBACK'] %>"
aws_key: "<%= ENV['AWS_KEY'] %>"
aws_secret: "<%= ENV['AWS_SECRET'] %>"
cloudwatch_key: "<%= ENV['CLOUDWATCH_KEY'] %>"
cloudwatch_secret: "<%= ENV['CLOUDWATCH_SECRET'] %>"
google_maps_key: "<%= ENV['GOOGLE_MAPS_KEY'] %>"
s3_bucket: "<%= ENV['AWS_S3_BUCKET'] %>"

test:

Expand Down
14 changes: 7 additions & 7 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: mysql2
database: REPLACE_ME
username: REPLACE_ME
password: REPLACE_ME
host: localhost
adapter: "<%= ENV['DB_ADAPTER'] %>"
database: "<%= ENV['DB_DATABASE'] %>"
username: "<%= ENV['DB_USERNAME'] %>"
password: "<%= ENV['DB_PASSWORD'] %>"
host: "<%= ENV['DB_HOST'] %>"

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
Expand All @@ -23,10 +23,10 @@ production:
adapter: mysql2
database: REPLACE_ME
username: REPLACE_ME
password: REPLACE_ME
password: REPLACE_ME
host: localhost

beta:
beta:
adapter: mysql2
database: REPLACE_ME
username: REPLACE_ME
Expand Down
5 changes: 5 additions & 0 deletions config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Load the rails application
require File.expand_path('../application', __FILE__)

# Load the app's custom environment variables here, so that they are loaded before environments/*.rb
# via https://stackoverflow.com/questions/4911607/is-it-possible-to-set-env-variables-for-rails-development-environment-in-my-code/11765775#11765775
app_environment_variables = File.join(Rails.root, 'config', 'app_environment_variables.rb')
load(app_environment_variables) if File.exists?(app_environment_variables)

# Initialize the rails application
Foursweep::Application.initialize!
5 changes: 5 additions & 0 deletions config/initializers/abstract_mysql2_adapter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'active_record/connection_adapters/mysql2_adapter'

class ActiveRecord::ConnectionAdapters::Mysql2Adapter
NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
end
2 changes: 1 addition & 1 deletion config/initializers/rollbar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Rollbar.configure do |config|
config.enabled = false
config.access_token = 'REPLACE_ME'
config.access_token = ENV['ROLLBAR_ACCESS_TOKEN']
config.exception_level_filters.merge!('ActionController::RoutingError' => 'ignore')
config.dj_threshold = 5

Expand Down
2 changes: 1 addition & 1 deletion config/initializers/secret_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Foursweep::Application.config.secret_token = 'REPLACE_ME'
Foursweep::Application.config.secret_token = ENV['APP_SECRET']

0 comments on commit 2bc3746

Please sign in to comment.