{"id":15405247,"url":"https://github.com/fnando/rails-env","last_synced_at":"2026-03-05T00:36:25.293Z","repository":{"id":24839416,"uuid":"28254220","full_name":"fnando/rails-env","owner":"fnando","description":"Avoid environment detection on Rails","archived":false,"fork":false,"pushed_at":"2023-09-04T13:13:55.000Z","size":65,"stargazers_count":19,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-25T08:54:05.564Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fnando.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["fnando"],"custom":["https://paypal.me/nandovieira/🍕"]}},"created_at":"2014-12-20T02:29:27.000Z","updated_at":"2022-11-12T11:56:45.000Z","dependencies_parsed_at":"2024-10-20T12:40:04.120Z","dependency_job_id":null,"html_url":"https://github.com/fnando/rails-env","commit_stats":{"total_commits":54,"total_committers":3,"mean_commits":18.0,"dds":0.4444444444444444,"last_synced_commit":"a01ba35b799718d5e6282b459bdb5bb900947a55"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/fnando/rails-env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Frails-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Frails-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Frails-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Frails-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnando","download_url":"https://codeload.github.com/fnando/rails-env/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Frails-env/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30102482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T23:59:36.199Z","status":"ssl_error","status_checked_at":"2026-03-04T23:56:48.556Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T16:15:42.499Z","updated_at":"2026-03-05T00:36:25.273Z","avatar_url":"https://github.com/fnando.png","language":"Ruby","funding_links":["https://github.com/sponsors/fnando","https://paypal.me/nandovieira/🍕"],"categories":[],"sub_categories":[],"readme":"# rails-env\n\n[![Tests](https://github.com/fnando/rails-env/workflows/ruby-tests/badge.svg)](https://github.com/fnando/rails-env)\n[![Code Climate](https://codeclimate.com/github/fnando/rails-env/badges/gpa.svg)](https://codeclimate.com/github/fnando/rails-env)\n[![Gem](https://img.shields.io/gem/v/rails-env.svg)](https://rubygems.org/gems/rails-env)\n[![Gem](https://img.shields.io/gem/dt/rails-env.svg)](https://rubygems.org/gems/rails-env)\n\nAvoid environment detection on Rails.\n\n## Installation\n\n```bash\ngem install rails-env\n```\n\nOr add the following line to your project's Gemfile:\n\n```ruby\ngem \"rails-env\"\n```\n\n## Usage\n\nInstead of checking for the current environment like this:\n\n```ruby\nif Rails.env.production?\n  # Do something with Rails.configuration\nend\n```\n\nYou can just use:\n\n```ruby\nRails.env.on(:production) do\n  config.assets.version = '1.0'\nend\n```\n\nLooks dumb, but you don't have to use the long `Rails.configuration` or assign\nit to a local variable. This is useful when you're extracting out things to\ninitializers.\n\nTo match all environments, use `:any`.\n\n```ruby\nRails.env.on(:any) do\n  config.assets.version = '1.0'\nend\n```\n\n## Gotcha\n\nNot all options can be defined through `Rails.env`. Rails propagates options on\nits engine file, meaning that every option defined on `config` afterwards must\nbe manually propagated.\n\nIt's hard to automatically propagate every existing option, so we have the most\ncommon options covered, as you can see in the list below:\n\n- action_controller\n- action_mailer\n- action_view\n- active_job\n- active_record\n- time_zone\n- auto/eager load paths\n- i18n\n- hosts\n\nIf you need to set any option not covered by rails-env,\n[please open a ticket](https://github.com/fnando/rails-env/issues/new).\n\n## Upgrading from previous versions\n\nPrevious versions used to yield the configuration; this is no longer true on\n1.0+.\n\nSo, instead of using\n\n```ruby\nRails.env.on(:development) do |config|\n  config.assets.version = '1.0'\nend\n```\n\nuse\n\n```ruby\nRails.env.on(:development) do\n  config.assets.version = '1.0'\nend\n```\n\n## Maintainer\n\n- [Nando Vieira](https://github.com/fnando)\n\n## Contributors\n\n- https://github.com/fnando/rails-env/contributors\n\n## Contributing\n\nFor more details about how to contribute, please read\nhttps://github.com/fnando/rails-env/blob/main/CONTRIBUTING.md.\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](https://opensource.org/licenses/MIT). A copy of the license can be\nfound at https://github.com/fnando/rails-env/blob/main/LICENSE.md.\n\n## Code of Conduct\n\nEveryone interacting in the rails-env project's codebases, issue trackers, chat\nrooms and mailing lists is expected to follow the\n[code of conduct](https://github.com/fnando/rails-env/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Frails-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnando%2Frails-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Frails-env/lists"}