I am setting the below environment variable.
ENV["RAILS_RELATIVE_URL_ROOT"] = "/prefix"
Is there any way of accessing this env variable other than ENV["RAILS_RELATIVE_URL_ROOT"]?
I know rails env can be accesses like Rails.env. Can all the env variables be accesses like that or is it something special for rails_env?
Rails.envonly gives you the value ofENV["RAILS_ENV"]orENV["RACK_ENV"]. If none of them were set, it returns"development".The
ENVobject is provided by Ruby.For another way to access it, you might consider either implementing it by yourself, or using the figaro gem. Set environment variables in a YAML config. Then they can be accessed like this: