Sha256: dffd3a26fc43efe84c4b1cf1f4d818521e074b0e70a46f3c345dd5fa912d16a2

Contents?: true

Size: 443 Bytes

Versions: 5

Compression:

Stored size: 443 Bytes

Contents

require 'foreman/util'
include Foreman::Util

unless Foreman::Application.config.secret_token
  tmp = Rails.root.join("tmp")
  Dir.mkdir(tmp) unless File.exist? tmp

  token_store = Rails.root.join("tmp", "secret_token")
  token = File.read(token_store) if File.exist? token_store
  unless token
    token = secure_token
    File.open(token_store, "w", 0600) { |f| f.write(token) }
  end
  Foreman::Application.config.secret_token = token
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/config/initializers/secret_token.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/config/initializers/secret_token.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/config/initializers/secret_token.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/config/initializers/secret_token.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/config/initializers/secret_token.rb