mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
fix secret_token init to always allow an override even if its too short
This commit is contained in:
parent
2b1a140c9b
commit
aaf41d227f
1 changed files with 7 additions and 4 deletions
|
@ -1,10 +1,13 @@
|
||||||
# We have had lots of config issues with SECRET_TOKEN to avoid this mess we are moving it to redis
|
# We have had lots of config issues with SECRET_TOKEN to avoid this mess we are moving it to redis
|
||||||
# if you feel strongly that it does not belong there use ENV['SECRET_TOKEN']
|
# if you feel strongly that it does not belong there use ENV['SECRET_TOKEN']
|
||||||
#
|
#
|
||||||
token = ENV['SECRET_TOKEN'] || $redis.get('SECRET_TOKEN')
|
token = ENV['SECRET_TOKEN']
|
||||||
|
unless token
|
||||||
|
token = $redis.get('SECRET_TOKEN')
|
||||||
unless token && token.length == 128
|
unless token && token.length == 128
|
||||||
token = SecureRandom.hex(64)
|
token = SecureRandom.hex(64)
|
||||||
$redis.set('SECRET_TOKEN',token)
|
$redis.set('SECRET_TOKEN',token)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Discourse::Application.config.secret_token = token
|
Discourse::Application.config.secret_token = token
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue