Where is rails.env set in Rails?

  question, ruby

When using ruby on rails, you often see Rails.env.development? Rails.env.production? Such an expression. I printed Rails.env directly and got the answer from development. After searching through the configuration files, I don’t know where it was configured. Is this the RAILS_ENV parameter specified at startup? Also, if this RAILS_ENV parameter is not passed, the default is development?

At first, I started to use rails, but I don’t know much about it. Please be instructed by the great god, and thank you very much ~

LookDocumentThe value of rails.env is the value of RAILS_ENV environment variable.

# File vendor/rails/railties/lib/initializer.rb, line 55
 def env
 @_env ||= ActiveSupport::StringInquirer.new(RAILS_ENV)
 end