palkan / anyway_config

Configuration library for Ruby gems and applications
MIT License
778 stars 52 forks source link

Local configuration using credentials doesn't work with Rails 7.1.2 #142

Closed ccrockett closed 10 months ago

ccrockett commented 10 months ago

What did you do?

I'm trying to generate local credential files for my anyway config using: EDITOR='code --wait' rails credentials:edit -e local

What did you expect to happen?

I expected it to create config/credentials/local.yml.enc and the respective local.key file

What actually happened?

Received an error:

/home/user/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/bundler/gems/rails-5621c93bfc8e/activesupport/lib/active_support/environment_inquirer.rb:16:in `initialize': 'local' is a reserved environment name (ArgumentError)

      raise(ArgumentError, "'local' is a reserved environment name") if env == "local"
...

Additional context

It looks like it's related to rails 7.1.2, this commit in particular

Environment

Ruby Version: ruby 3.2.2

Framework Version (Rails, whatever): Rails 7.2.0.alpha

Anyway Config Version: anyway_config 2.5.4

palkan commented 10 months ago

Thanks for reporting!

Added rails local_credentials:edit command to overcome this limitation (the env check is hard-coded deeply within the Rails codebase, there is no good way to patch it and keep rails credentials:edit -e local working)

palkan commented 10 months ago

Released in 2.6.0