added secret token warning in prd

added task to stamp builds
This commit is contained in:
Sam Saffron 2013-02-18 17:34:43 +11:00
parent cb0e53e701
commit 87b929eac6
4 changed files with 29 additions and 3 deletions

3
.gitignore vendored
View File

@ -68,3 +68,6 @@ chef/tmp/*
# .procfile
.procfile
# exclude our git version file for now
config/version.rb

View File

@ -1,7 +1,9 @@
require File.expand_path('../boot', __FILE__)
# our version info can be missing, we will do our best to figure it out
require File.expand_path('../version', __FILE__) rescue nil
require 'rails/all'
require "redis-store" # HACK
require 'redis-store' # HACK
# Plugin related stuff
require './lib/discourse_plugin_registry'
@ -50,7 +52,7 @@ module Discourse
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
config.encoding = 'utf-8'
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]

View File

@ -1,3 +1,16 @@
# Definitely change this when you deploy to production. Ours is replaced by jenkins.
# This token is used to secure sessions, we don't mind shipping with one to ease test and debug,
# however, the stock one should never be used in production, people will be able to crack
# session cookies.
#
# Discourse::Application.config.secret_token = "SET_SECRET_HERE"
# delete all lines below in production
if Rails.env.test? || Rails.env.development?
Discourse::Application.config.secret_token = "47f5390004bf6d25bb97083fb98e7cc133ab450ba814dd19638a78282b4ca291"
else
raise "You must set a secret token in config/initializers/secret_token.rb"
end

8
lib/tasks/build.rake Normal file
View File

@ -0,0 +1,8 @@
desc "stamp the current build with the git hash placed in version.rb"
task "build:stamp" => :environment do
git_version = `git rev-parse HEAD`.strip
File.open(Rails.root.to_s + '/config/version.rb', 'w') do |f|
f.write("$git_version = #{git_version.inspect}\n")
end
puts "Stamped current build with #{git_version}"
end