{"id":15959299,"url":"https://github.com/nickstenning/envmgr","last_synced_at":"2025-03-17T22:30:21.011Z","repository":{"id":4009889,"uuid":"5108385","full_name":"nickstenning/envmgr","owner":"nickstenning","description":"A tool to control the environment of spawned programs with config files","archived":false,"fork":false,"pushed_at":"2012-07-20T17:28:17.000Z","size":95,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-29T09:01:39.656Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"racaljk/hosts","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nickstenning.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-19T10:14:00.000Z","updated_at":"2015-05-23T22:00:40.000Z","dependencies_parsed_at":"2022-09-10T02:10:59.057Z","dependency_job_id":null,"html_url":"https://github.com/nickstenning/envmgr","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickstenning%2Fenvmgr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickstenning%2Fenvmgr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickstenning%2Fenvmgr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickstenning%2Fenvmgr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickstenning","download_url":"https://codeload.github.com/nickstenning/envmgr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221701657,"owners_count":16866216,"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":[],"created_at":"2024-10-07T14:41:12.097Z","updated_at":"2024-10-27T15:57:33.029Z","avatar_url":"https://github.com/nickstenning.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"ENVMGR\n======\n\nIT MANAGES YOUR ENV.\n\n`envmgr` is a simple application that will load environment variables for your app from a directory of config files.\n\nWhy would you want to do that? Perhaps you have a suite of applications which all need to know about some common resources, but which also have app-specific configurations. Here's how you'd achieve that with `envmgr`:\n\n    $ ENVMGR_ROOT=~/.envmgr\n    $ mkdir -p \"$ENVMGR_ROOT\"\n    $ cd \"$ENVMGR_ROOT\"\n    \n    $ cat \u003ecommon.conf \u003c\u003cEOM\n    SQL_URI=\"postgresql://user:pass@host...\"\n    ENVIRONMENT=production\n    EOM\n\n    $ cat \u003eapp_a.conf \u003c\u003cEOM\n    include common\n    APP_NAME=application_alpha\n    USER=maurice\n    EOM\n\n    $ cat \u003eapp_b.conf \u003c\u003cEOM\n    include common\n    APP_NAME=application_beta\n    USER=norman\n    EOM\n\nWith your config files created, you can now run your applications through `envmgr`:\n\n    $ envmgr -r \"$ENVMGR_ROOT\" -n app_a python run_app_a.py\n    $ envmgr -r \"$ENVMGR_ROOT\" -n app_b bundle exec ruby run_app_b.rb\n\n\nConfig syntax\n-------------\n\n### `include`\n\n    include other/file\n\nThe `include` directive does what it says on the tin: includes directives from another file. In the above example, `envmgr` will attempt to load directives from `$ENVMGR_ROOT/other/file.conf`. \n\n**NB**: you cannot include files that live outside of `$ENVMGR_ROOT`.\n\n**NB**: `envmgr` makes no attempt to detect cycles when processing the `include` directive. If you create such cycles then expect `envmgr` to blow up in your face.\n\n### `clear`\n\n    clear\n\nCompletely clear the environment. When used, this directive will usually come at the beginning of a config file.\n\n### `unset`\n\n    unset HOME\n\nUnset the specified environment variable\n\n### etc.\n\nAny other nonblank lines will be interpreted by `envmgr` as attempts to set an environment variable:\n\n    FOO=bar\n    BAR=\"baz\"\n    BAZ='bat'\n\nAnything that doesn't conform to one of the above patterns will probably raise a `ParseError` and the baby Jesus will cry. Or something.\n\nAs of version 0.0.3, `envmgr` will do some basic interpolation for you:\n\n    NAME=Marcus\n    HELLO_MARCUS=\"Hello, $NAME\"       # this will be \"Hello, Marcus\"\n    HELLO_UNDEF=\"Hello, $IDONTEXIST\"  # this will be \"Hello, \"\n    HELLO_SINGLES='Hello, $NAME'      # this will be \"Hello, $NAME\"\n\n**NB**: one gotcha is that `envmgr` does not use a shell-compliant lexer at the moment, so the following will *not* work as you might expect:\n\n    NAME=Marcus\n    HELLO_ESCAPED=\"Hello \\$NAME\"      # Gotcha! this will be \"Hello \\Marcus\"\n\nHacking\n-------\n\nMake yourself a [virtualenv](http://virtualenv.org), and then, in a checked out copy of this repository, run:\n\n    pip install -e .\n\nTo run the tests, you should do:\n\n    pip install tox\n    tox\n \n  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickstenning%2Fenvmgr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickstenning%2Fenvmgr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickstenning%2Fenvmgr/lists"}