summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-25 11:16:20 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-25 11:16:20 -0400
commit0f0974ffdffcd98665f7e36293813e68e0668bcf (patch)
treeb9444b082d370fb1110c9e64832f475862d62ab2
parent63a665823b8f05bf0b3a9acf9b18cc01252951fb (diff)
Use Figaro for configuration
-rw-r--r--.gitignore8
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock4
-rw-r--r--config/application.example.yml3
-rw-r--r--config/initializers/secret_token.rb6
5 files changed, 21 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index c9926d1..0859f70 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,7 +15,13 @@
/log/*.log
/tmp
-# The above is from Rails. The following is from Luke.
+# The above is from Rails.
+
+# The next lines are from `rails generate figaro:install`
+# Ignore application configuration
+/config/application.yml
+
+# The rest is from Luke.
/vendor/bundle
nohup.out
# As noted above, you probably want to add the following to your global git config.
diff --git a/Gemfile b/Gemfile
index 5a5be8b..5a6b98d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -52,6 +52,8 @@ gem 'delayed_job_active_record'
# Mailboxer supports a messaging and alerting system.
gem 'mailboxer'
+gem 'figaro'
+
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 145a7fc..2de3fea 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -50,6 +50,9 @@ GEM
delayed_job (>= 3.0, < 4.1)
erubis (2.7.0)
execjs (2.0.2)
+ figaro (0.7.0)
+ bundler (~> 1.0)
+ rails (>= 3, < 5)
foreigner (1.6.1)
activerecord (>= 3.0.0)
hike (1.2.3)
@@ -143,6 +146,7 @@ DEPENDENCIES
coffee-rails (~> 4.0.0)
daemons
delayed_job_active_record
+ figaro
httparty
jbuilder (~> 1.2)
jquery-rails
diff --git a/config/application.example.yml b/config/application.example.yml
new file mode 100644
index 0000000..a98b40e
--- /dev/null
+++ b/config/application.example.yml
@@ -0,0 +1,3 @@
+SECRET_TOKEN: 'cc884af613d0dd093f1d6c9153abac1200c5a0db923613245b80c5c3f5e9c9f9ba51712b702f2d494a22ddea8ab40601b38a41eb39eec97b50a7a2e37748b1bc'
+RIOT_API_KEY: 'ad539f86-22fd-474d-9279-79a7a296ac38'
+RIOT_API_REGION: 'na'
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb
index 604d43d..fbab4b9 100644
--- a/config/initializers/secret_token.rb
+++ b/config/initializers/secret_token.rb
@@ -9,4 +9,8 @@
# Make sure your secret_key_base is kept private
# if you're sharing your code publicly.
-Leaguer::Application.config.secret_key_base = 'cc884af613d0dd093f1d6c9153abac1200c5a0db923613245b80c5c3f5e9c9f9ba51712b702f2d494a22ddea8ab40601b38a41eb39eec97b50a7a2e37748b1bc'
+Leaguer::Application.config.secret_key_base = if Rails.env.development? or Rails.env.test?
+ ('x' * 30) # meets minimum requirement of 30 chars long
+else
+ ENV['SECRET_TOKEN']
+end