summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-11 12:28:35 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-11 12:28:35 +0100
commita742a9038210691169b407c2897a38ded8618f84 (patch)
tree5fa189ef16a19929519cc831089c0fe212297eab /db/migrate
parentb65c9f21c97371b6fbdeeae2e44f4111313b4337 (diff)
Generate a secret_token (for signed cookies).
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20130111111747_add_secret_token_to_gs_parameter.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/db/migrate/20130111111747_add_secret_token_to_gs_parameter.rb b/db/migrate/20130111111747_add_secret_token_to_gs_parameter.rb
new file mode 100644
index 0000000..bb99ace
--- /dev/null
+++ b/db/migrate/20130111111747_add_secret_token_to_gs_parameter.rb
@@ -0,0 +1,10 @@
+class AddSecretTokenToGsParameter < ActiveRecord::Migration
+ def up
+ require 'securerandom'
+ GsParameter.create(:name => 'SECRET_TOKEN', :section => 'Cookies', :value => SecureRandom.hex(64), :class_type => 'String')
+ end
+
+ def down
+ GsParameter.where(:name => 'SECRET_TOKEN').destroy_all
+ end
+end