fix for statechecker

This commit is contained in:
r888888888
2017-01-24 13:32:08 -08:00
parent e12d5e1290
commit 2aa7a8aa9c
6 changed files with 14 additions and 6 deletions

3
.env
View File

@@ -35,6 +35,9 @@
# Put these in .env.production or .env.development to define your dev/prod
# databases. Do not define it in .env or .env.local! It will be taken as your
# test database too, and rails will wipe it if you run the test suite.
#
# If you are connecting to PostgreSQL via socket, omit the hostname (e.g.
# postgresql:///danbooru2)
# export DATABASE_URL="postgresql://localhost/danbooru2"
# export ARCHIVE_DATABASE_URL="postgresql://localhost/archive_development"
# export RO_DATABASE_URL="$DATABASE_URL"

View File

@@ -1,3 +1,4 @@
set :user, "danbooru"
set :rails_env, "staging"
server "testbooru.donmai.us", :roles => %w(web app db), :primary => true, :user => "danbooru"

View File

@@ -1,9 +1,9 @@
require File.expand_path('../../state_checker', __FILE__)
StateChecker.check!
StateChecker.instance.check!
Rails.application.config.action_dispatch.session = {
:key => '_danbooru2_session',
:secret => StateChecker.session_secret_key
:secret => StateChecker.instance.session_secret_key
}
Rails.application.config.secret_token = StateChecker.secret_token
Rails.application.config.secret_token = StateChecker.instance.secret_token

View File

@@ -20,3 +20,7 @@ test:
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
staging:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

View File

@@ -1,5 +1,5 @@
module StateChecker
module_function
class StateChecker
include Singleton
def check!
ENV["SECRET_TOKEN"].present? || check_secret_token

View File

@@ -15,7 +15,7 @@ user 'danbooru', 'danbooru'
working_directory app_path
# Should be 'production' by default, otherwise use other env
rails_env = ENV['RAILS_ENV'] || 'production'
rails_env = ENV['RAILS_ENV'] || 'staging'
# Log everything to one file
stderr_path "log/unicorn.log"