Setting rails env is inconsistent

most of the times you can set the rails env from an ENV var, e.g. "RAILS_ENV=xyz rails server " but sometimes it bites you with a WTF where you need to set the env with “-e xyz”. One example I hit recently was that “RAILS_ENV=xyz rails credentials:edit” does NOT edit the credentials of ENV xyz.

2 Likes

A lot of commands include the EnvironmentArgument module to use the “-e” argument. However this module does not read the RAILS_ENV variable from the environment. This is perhaps by design. If not, then reading this environment variable in the module would be a one-stop solution to address all the commands that use “-e”. Would this be an acceptable way to go about fixing this? If so I can take up this issue.

It sounds logical to me and might be a good approach indeed :slight_smile: