Skip to content

Commit 328ba56

Browse files
committed
Added a sample config.yml file
* if there is no config.yml, the secret token initializer automatically copies it over so that it's easier for people to contribute to the project :-)
1 parent 510e2fe commit 328ba56

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ tmp/
99
.redcar
1010
bin/
1111
coverage
12+
config/config.yml

config/config.yml.sample

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# encoding: utf-8
2+
development:
3+
# Your secret key for verifying the integrity of signed cookies.
4+
# If you change this key, all old signed cookies will become invalid!
5+
# Make sure the secret is at least 30 characters and all random,
6+
# no regular words or you'll be exposed to dictionary attacks.
7+
# Used in config/initializers/secret_token.rb.
8+
# You can generate a good value for this by running `rake secret`.
9+
SECRET_TOKEN:

config/initializers/secret_token.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
ENV["SECRET_TOKEN"] = HacketyHackCom::Application.config.secret_token = SecureRandom.hex(30)
77
else
88
config_file = File.expand_path(File.join(Rails.root, '/config/config.yml'))
9+
unless File.exist? config_file
10+
require 'fileutils'
11+
FileUtils.cp config_file + '.sample', config_file
12+
end
913
config = YAML.load_file(config_file)
1014
# Generate the key, set it for the current environment, update the yaml file and move on
1115
ENV["SECRET_TOKEN"] = config[Rails.env]['SECRET_TOKEN'] = SecureRandom.hex(30)

0 commit comments

Comments
 (0)