{"id":16686340,"url":"https://github.com/yoheimuta/hubot-env","last_synced_at":"2025-06-18T16:32:48.728Z","repository":{"id":30862166,"uuid":"34419739","full_name":"yoheimuta/hubot-env","owner":"yoheimuta","description":"Hubot manages environment variables in process.env and redis via commands","archived":false,"fork":false,"pushed_at":"2015-05-10T07:43:08.000Z","size":228,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-03T07:27:05.686Z","etag":null,"topics":["coffeescript","hubot","redis"],"latest_commit_sha":null,"homepage":"","language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yoheimuta.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":"2015-04-22T22:35:51.000Z","updated_at":"2025-02-05T21:43:20.000Z","dependencies_parsed_at":"2022-09-02T02:50:31.040Z","dependency_job_id":null,"html_url":"https://github.com/yoheimuta/hubot-env","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/yoheimuta/hubot-env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoheimuta%2Fhubot-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoheimuta%2Fhubot-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoheimuta%2Fhubot-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoheimuta%2Fhubot-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yoheimuta","download_url":"https://codeload.github.com/yoheimuta/hubot-env/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoheimuta%2Fhubot-env/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260419221,"owners_count":23006235,"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":["coffeescript","hubot","redis"],"created_at":"2024-10-12T15:05:29.452Z","updated_at":"2025-06-18T16:32:43.693Z","avatar_url":"https://github.com/yoheimuta.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hubot-env\n\n[![NPM](https://nodei.co/npm/hubot-env.png)](https://nodei.co/npm/hubot-env/)\n\nHubot manages environment variables dynamically in process.env and redis.\n\n- load environment variables in process.env.\n- store environment variables in redis.\n- reload environment variables from redis to process.env in restarting hubot.\n- flush all environment variables previously loaded via commands in process.env and redis.\n\nIf you use [hubot-aws](https://github.com/yoheimuta/hubot-aws) for example, you can switch environment variables about AWS Account Credentials via hubot command dynamically.\n\n## Installation\n\nAdd **hubot-env** to your `package.json` file:\n\n```\nnpm install --save hubot-env\n```\n\nAdd **hubot-env** to your `external-scripts.json`:\n\n```json\n[\"hubot-env\"]\n```\n\nRun `npm install`\n\n## Commands\n\n```ruby\nhubot env current - Displays all current environment variables\nhubot env current --prefix=[prefix] - Displays current environment variables with prefix\nhubot env file - List name of files under HUBOT_ENV_BASE_PATH\nhubot env flush all - Flush all current environment variables in process.env and redis\nhubot env flush all --dry-run - Try flushing all current environment variables in process.env and redis\nhubot env load --filename=[filename] - Loads [filename] of environment variables in process.env and redis\nhubot env load --filename=[filename] --dry-run - Try loading [filename] of environment variables in process.env and redis\n```\n\n## Configuration\n\nSet environment variables like an example below.\n\n```ruby\nexport HUBOT_ENV_BASE_PATH=\"${HOME}/example\"\nexport HUBOT_ENV_HIDDEN_WORDS=\"SECRET_ACCESS_KEY,PASSWORD,TOKEN,API_KEY\"\n```\n\nYou can parepare your own env files by referring to the [example files](https://github.com/yoheimuta/hubot-env/tree/master/example).\n\n## Examples\n\nDisplay current environment variables. You can limit to output with a prefix.\n\n```ruby\nhubot\u003e hubot env current --prefix=HUBOT\nHUBOT_GITHUB_TOKEN=***\nHUBOT_ENV_HIDDEN_WORDS=SECRET_ACCESS_KEY,PASSWORD,TOKEN,API_KEY\nHUBOT_AUTH_ADMIN=ADMIN\nHUBOT_ENV_BASE_PATH=files/env\nHUBOT_GITHUB_REPO=yoheimuta/hubot-env\nHUBOT_CONCURRENT_REQUESTS=20\n```\n\nDisplay env files under HUBOT_ENV_BASE_PATH. You can select one in this list to load.\n\n```ruby\nhubot\u003e hubot env file\naws-cred-account1.env\naws-cred-account2.env\n```\n\nLoad new environment variables abount AWS credentials of account 1.\n\n```ruby\nhubot\u003e hubot env load --filename=aws-cred-account1.env\nLoading env --filename=aws-cred-account1.env, --dry-run=false...\nHUBOT_AWS_CREDENTIALS=account1\nHUBOT_AWS_ACCESS_KEY_ID=ACCESS_KEY1\nHUBOT_AWS_SECRET_ACCESS_KEY=***\nHUBOT_AWS_REGION=ap-northeast-1\n```\n\nThen, Switch to overwrite environment variables abount AWS credentials of account 2.\n\n```ruby\nhubot\u003e hubot env load --filename=aws-cred-account2.env\nLoading env --filename=aws-cred-account2.env, --dry-run=false...\nHUBOT_AWS_CREDENTIALS=account2\nHUBOT_AWS_ACCESS_KEY_ID=ACCESS_KEY2\nHUBOT_AWS_SECRET_ACCESS_KEY=***\nHUBOT_AWS_REGION=ap-northeast-1\n```\n\nReload environment variables when restarting hubot.\n\n```ruby\n$ ./bin/hubot\nhubot\u003e\n[Sun May 10 2015 16:19:20 GMT+0900 (JST)] INFO Using default redis on localhost:6379\n[Sun May 10 2015 16:19:20 GMT+0900 (JST)] INFO Data for hubot brain retrieved from Redis\nhubot env bootstrap loaded HUBOT_AWS_CREDENTIALS =\u003e account2\nhubot env bootstrap loaded HUBOT_AWS_ACCESS_KEY_ID =\u003e ACCESS_KEY2\nhubot env bootstrap loaded HUBOT_AWS_SECRET_ACCESS_KEY =\u003e ***\nhubot env bootstrap loaded HUBOT_AWS_REGION =\u003e ap-northeast-1\n\nhubot\u003e\n```\n\nFlush all loaded environment variables.\n\n```ruby\n# Dry-run\nhubot\u003e hubot env flush all --dry-run\nFlushing all --dry-run=true...\nComplete dry-run: loadedData={\n  HUBOT_AWS_CREDENTIALS: 'account2',\n  HUBOT_AWS_ACCESS_KEY_ID: 'ACCESS_KEY2',\n  HUBOT_AWS_SECRET_ACCESS_KEY: '***',\n  HUBOT_AWS_REGION: 'ap-northeast-1' }\n\n# Flush all\nhubot\u003e hubot env flush all\nFlushing all --dry-run=false...\nComplete flushing all\n\n# Confirm to be flushed data in redis and process.env\nhubot\u003e hubot brain show storage --key=_private.hubot-env\nnull\nhubot\u003e hubot env current --prefix=HUBOT\nHUBOT_GITHUB_TOKEN=***\nHUBOT_ENV_HIDDEN_WORDS=SECRET_ACCESS_KEY,PASSWORD,TOKEN,API_KEY\nHUBOT_AUTH_ADMIN=ADMIN\nHUBOT_ENV_BASE_PATH=files/env\nHUBOT_GITHUB_REPO=yoheimuta/hubot-env\nHUBOT_CONCURRENT_REQUESTS=20\n```\n\n## Recommended Usage\n\n### Use [hubot-brain-inspect](https://github.com/yoheimuta/hubot-brain-inspect)\n\n`hubot-brain-inspect` displays data saved in redis with specifying by keys.\n\n```ruby\nhubot\u003e hubot brain show storage --key=_private.hubot-env\n{ env:\n   { HUBOT_AWS_CREDENTIALS: 'account2',\n     HUBOT_AWS_ACCESS_KEY_ID: 'ACCESS_KEY2',\n     HUBOT_AWS_SECRET_ACCESS_KEY: '***',\n     HUBOT_AWS_REGION: 'ap-northeast-1' } }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoheimuta%2Fhubot-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoheimuta%2Fhubot-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoheimuta%2Fhubot-env/lists"}