{"id":25049205,"url":"https://github.com/milkdrinkers/env-applier-rs","last_synced_at":"2025-03-31T03:32:02.178Z","repository":{"id":275756082,"uuid":"926747433","full_name":"milkdrinkers/Env-Applier-RS","owner":"milkdrinkers","description":"Rust CLI for replacing environment variables in config files.","archived":false,"fork":false,"pushed_at":"2025-02-04T11:58:41.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T12:37:52.814Z","etag":null,"topics":["cli","config","configuration","devops","rust","rust-cli-apps","rust-lang","systemadministration"],"latest_commit_sha":null,"homepage":"","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/milkdrinkers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"darksaid98","patreon":"darksaid98","github":["darksaid98"]}},"created_at":"2025-02-03T19:41:24.000Z","updated_at":"2025-02-04T12:05:02.000Z","dependencies_parsed_at":"2025-02-04T12:47:58.387Z","dependency_job_id":null,"html_url":"https://github.com/milkdrinkers/Env-Applier-RS","commit_stats":null,"previous_names":["milkdrinkers/env-applier-rs"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milkdrinkers%2FEnv-Applier-RS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milkdrinkers%2FEnv-Applier-RS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milkdrinkers%2FEnv-Applier-RS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milkdrinkers%2FEnv-Applier-RS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/milkdrinkers","download_url":"https://codeload.github.com/milkdrinkers/Env-Applier-RS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246413377,"owners_count":20773053,"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":["cli","config","configuration","devops","rust","rust-cli-apps","rust-lang","systemadministration"],"created_at":"2025-02-06T08:16:52.671Z","updated_at":"2025-03-31T03:32:02.157Z","avatar_url":"https://github.com/milkdrinkers.png","language":"Rust","funding_links":["https://ko-fi.com/darksaid98","https://patreon.com/darksaid98","https://github.com/sponsors/darksaid98"],"categories":[],"sub_categories":[],"readme":"CLI functionality is simple. It reads a config that specifies a list of files and nodes. The user can then apply or unapply patches.\n\n## Command Line Usage\n\n`env-applier-rs` or (*ea*) is a CLI tool for applying environment variables in configuration files.\n\n### Basic Usage\n\n```bash\nea [COMMAND] [OPTIONS]\n```\n\n### Commands\n\n#### `apply`\nApplies the configuration by replacing variables in the target files with values from the environment.\n\n```bash\nea apply [OPTIONS]\n\nOptions:\n  -c, --config \u003cFILE\u003e  Path to config file\n  -h, --help          Print help information\n```\n\n#### `deapply`\nReverts the configuration by restoring the original values in the target files.\n\n```bash\nea deapply [OPTIONS]\n\nOptions:\n  -c, --config \u003cFILE\u003e  Path to config file\n  -h, --help          Print help information\n```\n\n#### `parse`\nValidates the configuration file without making any changes to the target files.\n\n```bash\nea parse [OPTIONS]\n\nOptions:\n  -c, --config \u003cFILE\u003e  Path to config file\n  -h, --help          Print help information\n```\n\n### Global Options\n\n```bash\n-h, --help       Print help information\n-V, --version    Print version information\n```\n\n### Examples\n\nApply configuration using the default config file (`config.toml`):\n```bash\nea apply\n```\n\nApply configuration using a specific config file:\n```bash\nea apply --config ./config.toml\n```\n\nValidate a specific config file:\n```bash\nea parse --config ./some-config.toml\n```\n\nRevert changes using the default config file (`config.toml`):\n```bash\nea deapply\n```\n\n### Notes\n\n- If no config file is specified, the tool will look for the default configuration file `config.toml` in your current working directory\n- The tool will load environment variables from your system, `.env` \u0026 `.env.local`\n- The parse command can be used to validate config files before applying changes\n\n### Configuration\n\nThe configuration file is what tells Env Applier what to change and where. It should be a single `Toml` file located in the *current working directory* or specified using the command argument for config.\n\nBy default `config.toml` is loaded by the CLI.\n\n```toml\n[environment]\n# In this case the de-apply output would be something like \"%%SOME_ENV_NAME%%\"\nprefix = \"%%\" # What env variables should be prefixed with when changes are de-applied\nsuffix = \"%%\" # What env variables should be suffixed with when changes are de-applied\n\n[specific]\n    [specific.json]\n    [specific.toml]\n    [specific.properties]\n    [specific.yaml]\n        [[specific.yaml.locations]]\n        file = \"test.yml\" # The file which contains the config node\n        node = \"database.password\" # The config node to change\n        variable = \"DB_PASS\" # This is the env variable that is parsed on apply, and replaced back on de-apply\n\n        [[specific.yaml.locations]]\n        file = [ \"test.yml\", \"test2.yml\", ] # Allows multiple files to be updated\n        node = \"database.host\" \n        variable = \"DB_HOST\"\n\n        [[specific.yaml.locations]]\n        file = \"test.yml\"\n        node = [ \"database.name\", ] # Allow multiple nodes to be updated\n        variable = \"DB_NAME\"\n\n        [[specific.yaml.locations]]\n        files = \"test.yml\" # Alias of \"file\"\n        nodes = \"server.password\" # Alias of \"node\"\n        variable = \"DB_PASS\"\n        default = \"%%OVERRIDE_DEAPPLY%%\" # Overrides the \"variable\" field when de-applying\n        override = { exemptApply = false, exemptDeapply = false } # Exempt from applying or de-applying changes\n\n        [[specific.yaml.locations]]\n        files = [ \"test.yml\", ] # Alias of \"file\"\n        nodes = [ \"database.password\", \"server.password\" ] # Alias of \"node\"\n        variable = \"DB_PASS\"\n        default = \"%%DB_CUSTOM_VARIABLE%%\"\n        override = { exemptApply = false, exemptDeapply = false }\n```\n\n### Environment Variables\n\nEnvironment variables are loaded from your system and the files `.env` \u0026 `.env.local` (*Located in your current working directory*).\n\n`.env` files follow `.properties` format and support variable expnasion. Here is an example `.env` file which makes the following environment variables available to the program:\n```properties\n# SQL Database Settings\nDB_NAME=database\nDB_USER=root\nDB_PASS=123\nDB_HOST=localhost\nDB_PORT=3306\n\n# Example of variable expansion\nDB_URL=mysql://$DB_USER:$DB_PASS@$DB_ADDRESS/$DB_NAME\nDB_ADDRESS=$DB_HOST:$DB_PORT\n```\n\n### File Formats\n\n| Format      | Comments Support | Table Support | Array Support |\n|-------------|------------------|---------------|---------------|\n| **YAML**    | ✅ (Using `#`)   | ✅ (Maps)     | ✅ (Sequences) |\n| **JSON**   | ❌  | ❌            | ✅             |\n| **JSONC**   | ✅ (Using `//`)  | ❌            | ✅             |\n| **TOML**    | ✅ (Using `#`)   | ✅            | ✅             |\n| **Properties** | ✅ (Using `#`/`!`)| ❌         | ❌             |\n\nThe specs \u0026 criteria for modifications is straightforward:\n- Only replaces the value of a node, it never adds entries to the file\n- Does not \"*reformat*\" the file at all\n- Respects previous whitespace/indentation/line endings\n- Respects comments in applicable config formats (*Including header, footer \u0026 trailing comments*)\n- Able to traverse \u0026 modify complex data structures in supported file formats\n- Editing a file should never break the syntax of the config\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilkdrinkers%2Fenv-applier-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilkdrinkers%2Fenv-applier-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilkdrinkers%2Fenv-applier-rs/lists"}