class Rails::Application

def secret_key_base

the correct place to store it is in the encrypted credentials file.
then +credentials.secret_key_base+, and finally +secrets.secret_key_base+. For most applications,
In all other environments, we look for it first in ENV["SECRET_KEY_BASE"],

temporary file in tmp/development_secret.txt.
In development and test, this is randomly generated and stored in a

including the ones that sign and encrypt cookies.
is used to create all ActiveSupport::MessageVerifier and ActiveSupport::MessageEncryptor instances,
The secret_key_base is used as the input secret to the application's key generator, which in turn
def secret_key_base
  if Rails.env.development? || Rails.env.test?
    secrets.secret_key_base ||= generate_development_secret
  else
    validate_secret_key_base(
      ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || secrets.secret_key_base
    )
  end
end