Migrate all secrets to config/secrets.yml

This commit is contained in:
Henne Vogelsang 2014-05-12 18:32:26 +02:00
parent 9090cc0d38
commit ee5d48d494
8 changed files with 29 additions and 20 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
config/application.rb
config/config.yml
config/secrets.yml
config/database.yml
/vendor/cache
/vendor/cache-old

View file

@ -14,6 +14,7 @@ before_install:
before_script:
- cp config/database.yml.example config/database.yml
- cp config/config.yml.example config/config.yml
- cp config/secrets.yml.example config/secrets.yml
- RAILS_ENV=test bundle exec rake db:migrate --trace
script:
- bundle exec rspec --color --format documentation

View file

@ -5,14 +5,9 @@ defaults: &defaults
devise_mail_sender: "no-reply@localhost"
# The hostname to be used when building the URL in the emails
url_for_emails: "localhost:3000"
# A secret key for your rails app. You can generate one with 'rake secret'
secret_key: 12345
# A secret key. You can generate one with 'rake secret'
devise_secret_key: '12345'
# errbit configuration, get your own instance: https://github.com/errbit/errbit
#errbit_key: 123456789101112131415
#errbit_key: See config/secrets.yml
#errbit_host: errbit.exmaple.com
cookies_secret_token: 'secretstringwhichshouldbechanged'
development:
<<: *defaults

View file

@ -12,4 +12,3 @@ end
# Initialize the rails application
Osem::Application.initialize!
Osem::Application.config.secret_keybase = CONFIG['secret_key']

View file

@ -2,7 +2,7 @@
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# ==> Secret key, generate one with `rake secret`
config.secret_key = CONFIG['devise_secret_key']
config.secret_key = Rails.application.secrets.devise_secret_key
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,

View file

@ -1,11 +1,11 @@
HoptoadNotifier.configure do |config|
# Change this to some sensible data for your errbit instance
config.api_key = CONFIG["errbit_key"] || ""
config.host = CONFIG["errbit_host"] || ""
config.api_key = Rails.application.secrets.errbit_key || ''
config.host = CONFIG['errbit_host'] || ''
if config.api_key.blank? || config.host.blank?
config.development_environments = "production development test"
config.development_environments = 'production development test'
else
config.development_environments = "development test"
config.development_environments = 'development test'
end
config.ignore_only = %w{
@ -14,7 +14,7 @@ HoptoadNotifier.configure do |config|
config.ignore_by_filter do |exception_data|
ret=false
if exception_data[:error_class] == "ActionController::RoutingError"
if exception_data[:error_class] == 'ActionController::RoutingError'
message = exception_data[:error_message]
ret=true if message =~ %r{\[GET\]}
end

View file

@ -1,7 +0,0 @@
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# 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.
Osem::Application.config.secret_token = CONFIG['cookies_secret_token']

View file

@ -0,0 +1,20 @@
defaults: &defaults
# You can generate secret keys with 'rake secret'
# For rails cookies
secret_key_base: '12345'
# For devise login tokens
devise_secret_key: '12345'
# Your errbit API key
# errbit_key: '12345'
development:
<<: *defaults
test:
<<: *defaults
production:
<<: *defaults