{"id":13492927,"url":"https://github.com/bitrise-io/envman","last_synced_at":"2025-03-28T11:31:04.873Z","repository":{"id":33294237,"uuid":"36938965","full_name":"bitrise-io/envman","owner":"bitrise-io","description":"Environment variable manager","archived":false,"fork":false,"pushed_at":"2025-03-10T15:16:50.000Z","size":9072,"stargazers_count":248,"open_issues_count":12,"forks_count":26,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-10T16:37:23.291Z","etag":null,"topics":["bitrise","ci","production-code"],"latest_commit_sha":null,"homepage":"","language":"Go","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/bitrise-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-05T15:02:28.000Z","updated_at":"2025-03-04T12:46:54.000Z","dependencies_parsed_at":"2024-03-27T16:43:21.976Z","dependency_job_id":"cd4324c0-9c73-45b7-8751-8b54228696a5","html_url":"https://github.com/bitrise-io/envman","commit_stats":{"total_commits":378,"total_committers":17,"mean_commits":"22.235294117647058","dds":"0.47089947089947093","last_synced_commit":"4a3e6bd8252af19d4ecf3ab3067cd253660ee4a4"},"previous_names":[],"tags_count":58,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitrise-io%2Fenvman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitrise-io%2Fenvman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitrise-io%2Fenvman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitrise-io%2Fenvman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitrise-io","download_url":"https://codeload.github.com/bitrise-io/envman/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246020829,"owners_count":20710827,"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":["bitrise","ci","production-code"],"created_at":"2024-07-31T19:01:10.513Z","updated_at":"2025-03-28T11:31:04.256Z","avatar_url":"https://github.com/bitrise-io.png","language":"Go","funding_links":[],"categories":["Go","others"],"sub_categories":[],"readme":"# envman\n\nManage your Environment Variable collections. Switch between Environment Variable sets\nquickly and easily, or run a single command with a pre-defined set of Environment Variables.\n\n`envman` can also be used as a bridge between separate tools, one tool can register its\noutputs through `envman` and the next tool can access these as simple environment variables.\n\n**Public Beta:** this repository is still under active development,\nfrequent changes are expected, but we we don't plan to introduce breaking changes,\nunless really necessary. **Feedback is greatly appreciated!**\n\n*Part of the Bitrise Continuous Integration, Delivery and Automations Stack,\nwith [bitrise](https://github.com/bitrise-io/bitrise) and [stepman](https://github.com/bitrise-io/stepman).*\n\n## Who and for what?\n\n- connect tools with each other : one tool saves an ENV, the other uses it (input \u0026 output)\n- manage your environment-sets : use different ENVs for different projects\n- complex environment values : if you want to store a complex input as ENV (for example a change log text/summary), `envman` makes this easy, you don't have to encode the value so that when you call bash's `export KEY=value` it will store your value as you intended. You can just give `envman` the value as it is through a `--valuefile` option or as an input stream (or just edit the related `.envstore.yml` file manually), no encoding required.\n- switch between environment sets : if you work on multiple projects where each one requires different environments you can manage this with `envman`\n\n## Install\n\nCheck the latest release for instructions at: [https://github.com/bitrise-io/envman/releases](https://github.com/bitrise-io/envman/releases)\n\n## How? - Use cases\n\n- multi PATH handling: you have `packer` in your `$HOME` dir, in a bin subdir and terraform in another\n- create an envman `.envset` to include these in your `$PATH`\n\n## Develop \u0026 Test in Docker\n\nBuild:\n\n```\ndocker build -t envman .\n```\n\nRun:\n\n```\ndocker run --rm -it -v `pwd`:/go/src/github.com/bitrise-io/envman --name envman-dev envman /bin/bash\n```\n\n## How does it work?\n\n`envman` will run the command you specify\nwith the environments found in its environment store.\n\nFirst, run `envman init` to create an empty `.envstore.yml` file in the current directory.\nNow when you add a new key-value pair with `envman add` it stores\nthe key and value in an `.envstore.yml` file in the current\ndirectory (this can be changed), and when you call `envman run`\nthe next time the environments in the `.envstore.yml` file will\nbe loaded for the command, and the command will be executed\nwith an environment which includes the specified environment\nvariables.\n\nThis is the same as you would manually set all the\nenvironments, one by one with `export KEY=value` (in bash)\nbefore calling the command.\n\n`envman` makes it easy to switch between environment sets\nand to isolate these environment sets from each other -\nyou don't have to `unset` environments, the specified\nenvironment set will only be available for that single\nrun of `envman` / the command and won't affect subsequent\ncalls of the command or `envman`.\n\n## Usage example: Simple Bash example\n\nAdd/store an environment variable:\n\n```\nenvman add --key MY_TEST_ENV_KEY --value 'test value for test key'\n```\n\nEcho it:\n\n```\nenvman run bash -c 'echo \"Environment test: $MY_TEST_ENV_KEY\"'\n```\n\n## Mark an Env Var as sensitive and redact it from the build logs\n\nAdd/store an environment variable:\n\n```\nenvman add --key MY_SECRET_ENV_KEY --value 'this is a secret value' --sensitive\n```\n\n*Why `bash -c` is required? Because `echo` in itself\ndoes not do any environment expansion, it simply prints\nits input. So if you want to see the value of an environment\nyou have to run it through a tool/shell which actually\nperforms the environment expansion (replaces the environment\nkey with the value associated with it).*\n\n## Usage example: Ruby\n\n### Add environment variable with `--value` flag\n\n```\nsystem( \"envman add --key SOME_KEY --value 'some value' --expand false\" )\n```\n\n### Add environment variable from an input stream\n\n```\nIO.popen('envman add --key SOME_KEY', 'r+') {|f|\n\tf.write('some value')\n\tf.close_write\n\tf.read\n}\n```\n\n### Add environment variable with a value file\n\n```\nrequire 'tempfile'\n\nfile = Tempfile.new('SOME_FILE_NAME')\nfile.write('some value')\nfile.close\n\nsystem( \"envman add --key SOME_KEY --valuefile #{file.path}\" )\n\nfile.unlink\n```\n\n## Usage example: Go\n\n### Add environment variable with `--value` flag\n\n```\nimport \"os/exec\"\n\nc := exec.Command(\"envman\", \"add\", \"--key\", \"SOME_KEY\", \"--value\", \"some value\")\nerr := c.Run()\nif err != nil {\n   // Handle error\n}\n```\n\n### Add environment variable from an input stream\n\n```\nimport \"os/exec\"\n\nfunc RunPipedEnvmanAdd(keyStr, valueStr string) error {\n\tenvman := exec.Command(\"envman\", \"add\", \"--key\", keyStr)\n\tenvman.Stdin = strings.NewReader(valueStr)\n\tenvman.Stdout = os.Stdout\n\tenvman.Stderr = os.Stderr\n\treturn envman.Run()\n}\n\nerr := RunPipedEnvmanAdd(\"SOME_KEY\", \"some value\")\nif err != nil {\n\t// Handle error\n}\n```\n\n### Add environment variable with a value file\n\n```\nimport (\n\t\"os/exec\"\n\t\"fmt\"\n)\n\nc := exec.Command(\"envman\", \"add\", \"--key\", \"SOME_KEY\", \"--valuefile\", \"/path/to/file/which/contains/the/value\")\nerr := c.Run()\nif err != nil {\n\t// Handle error\n}\n```\n\n## Usage example: Bash\n\n### Add environment variable with `--value` flag\n\n```\nenvman add --key SOME_KEY --value 'some value'\n```\n\n### Add environment variable from an input stream\n\n```\necho \"some value\" | envman add --key SOME_KEY\n```\n\n### Add environment variable with a value file\n\n```\nenvman add --key SOME_KEY --valuefile /path/to/file/which/contains/the/value --expand false\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitrise-io%2Fenvman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitrise-io%2Fenvman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitrise-io%2Fenvman/lists"}