{"id":38705060,"url":"https://github.com/runlevel5/ejson2env-rs","last_synced_at":"2026-01-17T10:54:58.756Z","repository":{"id":332697839,"uuid":"1134676864","full_name":"runlevel5/ejson2env-rs","owner":"runlevel5","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-15T06:24:24.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-15T09:42:07.833Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/runlevel5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-15T03:28:49.000Z","updated_at":"2026-01-15T06:24:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/runlevel5/ejson2env-rs","commit_stats":null,"previous_names":["runlevel5/ejson2env-rs"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/runlevel5/ejson2env-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runlevel5%2Fejson2env-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runlevel5%2Fejson2env-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runlevel5%2Fejson2env-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runlevel5%2Fejson2env-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/runlevel5","download_url":"https://codeload.github.com/runlevel5/ejson2env-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runlevel5%2Fejson2env-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28506593,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T10:25:30.148Z","status":"ssl_error","status_checked_at":"2026-01-17T10:25:29.718Z","response_time":85,"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":"2026-01-17T10:54:58.676Z","updated_at":"2026-01-17T10:54:58.750Z","avatar_url":"https://github.com/runlevel5.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ejson2env-rs\n\nA Rust port of [Shopify/ejson2env](https://github.com/Shopify/ejson2env) for exporting encrypted EJSON/EYAML/ETOML secrets as shell environment variables. Drop-in replacement with the same CLI interface, plus added support for YAML and TOML formats.\n\n## What It Does\n\nReads an EJSON, EYAML, or ETOML file, decrypts the `environment` object, and outputs shell export statements.\n\n**Input** (`secrets.ejson`):\n```json\n{\n    \"_public_key\": \"\u003cpublic key\u003e\",\n    \"environment\": {\n        \"DATABASE_URL\": \"\u003cencrypted\u003e\",\n        \"API_KEY\": \"\u003cencrypted\u003e\",\n        \"_ENVIRONMENT\": \"production\"\n    }\n}\n```\n\n**Or** (`secrets.eyaml`):\n```yaml\n_public_key: \"\u003cpublic key\u003e\"\nenvironment:\n  DATABASE_URL: \"\u003cencrypted\u003e\"\n  API_KEY: \"\u003cencrypted\u003e\"\n  _ENVIRONMENT: production\n```\n\n**Or** (`secrets.etoml`):\n```toml\n_public_key = \"\u003cpublic key\u003e\"\n\n[environment]\nDATABASE_URL = \"\u003cencrypted\u003e\"\nAPI_KEY = \"\u003cencrypted\u003e\"\n_ENVIRONMENT = \"production\"\n```\n\n**Output**:\n```shell\nexport API_KEY='decrypted-api-key'\nexport DATABASE_URL='decrypted-database-url'\nexport _ENVIRONMENT='production'\n```\n\n\u003e **Underscore Prefix:** Keys prefixed with `_` (e.g., `_ENVIRONMENT`) are left **unencrypted** in the secrets file. This is useful for non-sensitive configuration values that you want to keep readable. Use `--trim-underscore-prefix` to strip the first leading underscore from variable names in the output (e.g., `_ENVIRONMENT` becomes `ENVIRONMENT`, but `__DOUBLE` becomes `_DOUBLE`).\n\n\u003e **Shell Compatibility:** This tool generates `export` statements, which are supported by POSIX-compatible shells such as **bash**, **zsh**, **sh**, and **ksh**. It is not compatible with shells that use different syntax for environment variables (e.g., fish, csh, tcsh).\n\n## Supported File Formats\n\nFormat detection is automatic based on file extension:\n\n| Format | Extensions |\n|--------|------------|\n| JSON   | `.ejson`, `.json` |\n| YAML   | `.eyaml`, `.yaml`, `.yml` |\n| TOML   | `.etoml`, `.toml` |\n\n## Installation\n\n### From Source\n\n```shell\ngit clone https://github.com/runlevel5/ejson2env-rs.git\ncd ejson2env-rs\ncargo build --release\ncp ./target/release/ejson2env ~/.local/bin/\n```\n\n### Pre-built Binaries\n\nDownload from [Releases](https://github.com/runlevel5/ejson2env-rs/releases).\n\n\u003e **Note:** No Homebrew, Deb, or RPM packages yet. Contributions welcome!\n\n## Usage\n\n### Basic Usage\n\n```shell\n# Output export statements (EJSON)\nejson2env secrets.ejson\n\n# Output export statements (EYAML)\nejson2env secrets.eyaml\n\n# Output export statements (ETOML)\nejson2env secrets.etoml\n\n# Load secrets into current shell\neval $(ejson2env secrets.ejson)\neval $(ejson2env secrets.eyaml)\neval $(ejson2env secrets.etoml)\n```\n\n### Options\n\n```\nejson2env [OPTIONS] \u003cFILE\u003e\n\nOptions:\n  -k, --keydir \u003cDIR\u003e     Directory containing EJSON keys [default: /opt/ejson/keys]\n                         Can also be set via EJSON_KEYDIR env var\n      --key-from-stdin   Read the private key from stdin\n  -q, --quiet            Omit \"export\" prefix (output: KEY='value')\n      --trim-underscore-prefix  Remove the first leading underscore from variable names\n                                (e.g., _ENVIRONMENT becomes ENVIRONMENT, __KEY becomes _KEY)\n  -h, --help             Print help\n  -V, --version          Print version\n```\n\n### Examples\n\n#### EJSON\n\n```shell\n# Use a custom key directory\nejson2env -k /path/to/keys secrets.ejson\n\n# Pipe key from another source\ncat /path/to/private.key | ejson2env --key-from-stdin secrets.ejson\n\n# Output without \"export\" prefix (useful for .env files)\nejson2env -q secrets.ejson \u003e .env\n\n# Strip leading underscores from variable names\n# Useful when you have unencrypted keys like _ENVIRONMENT that should\n# be exported as ENVIRONMENT (without the underscore prefix)\nejson2env --trim-underscore-prefix secrets.ejson\n```\n\n#### EYAML\n\n```shell\n# Use a custom key directory\nejson2env -k /path/to/keys secrets.eyaml\n\n# Pipe key from another source\ncat /path/to/private.key | ejson2env --key-from-stdin secrets.eyaml\n\n# Output without \"export\" prefix (useful for .env files)\nejson2env -q secrets.eyaml \u003e .env\n\n# Strip leading underscores from variable names\n# Useful when you have unencrypted keys like _ENVIRONMENT that should\n# be exported as ENVIRONMENT (without the underscore prefix)\nejson2env --trim-underscore-prefix secrets.eyaml\n```\n\n#### ETOML\n\n```shell\n# Use a custom key directory\nejson2env -k /path/to/keys secrets.etoml\n\n# Pipe key from another source\ncat /path/to/private.key | ejson2env --key-from-stdin secrets.etoml\n\n# Output without \"export\" prefix (useful for .env files)\nejson2env -q secrets.etoml \u003e .env\n\n# Strip leading underscores from variable names\n# Useful when you have unencrypted keys like _ENVIRONMENT that should\n# be exported as ENVIRONMENT (without the underscore prefix)\nejson2env --trim-underscore-prefix secrets.etoml\n```\n\n## Key Management\n\nEJSON uses public-key cryptography. The private key must be available at decryption time:\n\n1. **File-based** (default): Place the private key in a file named after the public key in the keydir (e.g., `/opt/ejson/keys/\u003cpublic_key\u003e`)\n2. **Stdin**: Pass via `--key-from-stdin`\n3. **Environment**: Set `EJSON_KEYDIR` to override the default key directory\n\n## Related Projects\n\n- [ejson](https://github.com/Shopify/ejson) - Original EJSON tool by Shopify\n- [ejson-rs](https://github.com/runlevel5/ejson-rs) - Rust EJSON library this tool is built on (supports JSON, YAML, and TOML)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunlevel5%2Fejson2env-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunlevel5%2Fejson2env-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunlevel5%2Fejson2env-rs/lists"}