17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/tokenifier/cipher.rb', line 17
def load_rails_secret
return unless defined?(Rails)
filename = Rails.root.join('config', 'tokenifier.yml')
if File.exists?(filename)
config = YAML.load(
ERB.new(
IO.read(filename)
).result
)[Rails.env]
@secret = config['secret']
else
@secret = Tokenifier::Random.secret
Rails.logger.warn "*** Tokenifier warning:"
Rails.logger.warn "*** Config tokenifier.yml file not found."
Rails.logger.warn "*** Run rails g tokenifier:install to generate one"
Rails.logger.warn "*** Using secret: #{@secret}"
end
@secret
end
|