{"id":13879828,"url":"https://github.com/karafka/envlogic","last_synced_at":"2025-07-16T15:33:09.031Z","repository":{"id":1218958,"uuid":"41670599","full_name":"karafka/envlogic","owner":"karafka","description":"[Unmaintained] Envlogic is a library used to manage environments for your Ruby application in a similar to Rails.env way","archived":true,"fork":false,"pushed_at":"2022-12-26T10:32:08.000Z","size":218,"stargazers_count":17,"open_issues_count":0,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-29T13:28:19.049Z","etag":null,"topics":["ruby"],"latest_commit_sha":null,"homepage":"https://karafka.io","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/karafka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-31T10:54:49.000Z","updated_at":"2023-01-31T16:39:15.000Z","dependencies_parsed_at":"2023-01-13T11:01:45.154Z","dependency_job_id":null,"html_url":"https://github.com/karafka/envlogic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karafka%2Fenvlogic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karafka%2Fenvlogic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karafka%2Fenvlogic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karafka%2Fenvlogic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karafka","download_url":"https://codeload.github.com/karafka/envlogic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226021892,"owners_count":17561307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ruby"],"created_at":"2024-08-06T08:02:34.840Z","updated_at":"2024-11-24T08:31:50.298Z","avatar_url":"https://github.com/karafka.png","language":"Ruby","readme":"# Envlogic [Unmaintained]\n\nNote: This library is no longer in use in the Karafka ecosystem. It was developed for Karafka versions prior to 2.0.\n\n[![Build Status](https://github.com/karafka/envlogic/workflows/ci/badge.svg)](https://github.com/karafka/envlogic/actions?query=workflow%3Aci)\n[![Gem Version](https://badge.fury.io/rb/envlogic.svg)](http://badge.fury.io/rb/envlogic)\n[![Join the chat at https://slack.karafka.io](https://raw.githubusercontent.com/karafka/misc/master/slack.svg)](https://slack.karafka.io)\n\nEnvlogic is a library used to manage environments for your Ruby application in a similar to Rails.env way.\n\n## Installation\n\nAdd the gem to your Gemfile\n```ruby\n  gem 'envlogic'\n```\n\n## Usage\n\n### On a class/module level\n\nExtend your class or module in which you want to use this library with **Envlogic** module.\n\n```ruby\nmodule ExampleModule\n  extend Envlogic\n  # code of this module\nend\n```\n\nOnce you extend your class/module with it, you will have two additional methods (with two aliases):\n\n - *.env* (.environment) - obtain current env and work with it\n - *.env=* (.environment=) - set your own environment\n\n```ruby\n  ExampleModule.env = 'development'\n  ExampleModule.env.development? # =\u003e true\n  ExampleModule.env.production? # =\u003e false\n```\n\n### On a per instance basis\n\nInclude the **Envlogic** module in the class for which instances you want to use it.\n\n```ruby\nclass ExampleClass\n  include Envlogic\n  # code of this class\nend\n```\n\nOnce you include it in your class, you will have two additional methods (with two aliases):\n\n - *.env* (.environment) - obtain current env and work with it\n - *.env=* (.environment=) - set your own environment\n\n```ruby\n  instance = ExampleClass.new\n  instance.env = 'development'\n  instance.env.development? # =\u003e true\n  instance.env.production? # =\u003e false\n```\n\n### ENV variables key names and default fallbacks\n\n#### Application root directory env key name\n\nBy default, the gem is looking for ENV variable that is based on your application root directory.\n\nFor example, if your application lies in */home/deploy/my_app* it will look for **MY_APP_ENV** variable.\n\n#### Module/class name based env key name\n\nIf there's no env value under the app directory name key, it will fallback to the module/class based env variable name (including the whole namespace chain):\n\n```ruby\nmodule Basic\n  module Karafka\n    extend Envlogic\n    # code of Karafka module\n  end\nend\n```\n\n```ruby\nENV['FACEBOOK_API_ENV'] = nil\nENV['BASIC_KARAFKA_ENV'] = 'development'\n\nBasic::Karafka.env.production? # =\u003e false\nBasic::Karafka.env.development? # =\u003e true\n```\n\n#### Default fallbacks\n\nIf there's no other way to determine the environment, Envlogic will fallback to ENV['RACK_ENV'] and if it fails, it will just assume that we're in 'development' mode.\n\nYou can also assign the environment directly in Ruby:\n\n```ruby\nmodule Basic\n  module Karafka\n    extend Envlogic\n    # code of Karafka module\n  end\nend\n\nBasic::Karafka.env = :development\nBasic::Karafka.env.production? # =\u003e false\nBasic::Karafka.env.development? # =\u003e true\n```\n\n## References\n\n* [Karafka framework](https://github.com/karafka/karafka)\n* [Envlogic Actions CI](https://github.com/karafka/envlogic/actions?query=workflow%3Aci)\n* [Envlogic Coditsu](https://app.coditsu.io/karafka/repositories/envlogic)\n\n## Note on contributions\n\nFirst, thank you for considering contributing to the Karafka ecosystem! It's people like you that make the open source community such a great community!\n\nEach pull request must pass all the RSpec specs, integration tests and meet our quality requirements.\n\nFork it, update and wait for the Github Actions results.\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarafka%2Fenvlogic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarafka%2Fenvlogic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarafka%2Fenvlogic/lists"}