Method: Rails::Application::Configuration#secret_key_base=

Defined in:
railties/lib/rails/application/configuration.rb

#secret_key_base=(new_secret_key_base) ⇒ Object



516
517
518
519
520
521
522
523
524
525
526
# File 'railties/lib/rails/application/configuration.rb', line 516

def secret_key_base=(new_secret_key_base)
  if new_secret_key_base.nil? && Rails.env.local?
    @secret_key_base = generate_local_secret
  elsif new_secret_key_base.is_a?(String) && new_secret_key_base.present?
    @secret_key_base = new_secret_key_base
  elsif new_secret_key_base
    raise ArgumentError, "`secret_key_base` for #{Rails.env} environment must be a type of String`"
  else
    raise ArgumentError, "Missing `secret_key_base` for '#{Rails.env}' environment, set this string with `bin/rails credentials:edit`"
  end
end