{"id":44160687,"url":"https://github.com/sitture/env-config","last_synced_at":"2026-02-09T07:39:54.609Z","repository":{"id":38016302,"uuid":"151250859","full_name":"sitture/env-config","owner":"sitture","description":"A simple utility to manage environment configs in Java-based projects by merging .properties files and environment variables overrides.","archived":false,"fork":false,"pushed_at":"2026-01-12T09:11:33.000Z","size":525,"stargazers_count":22,"open_issues_count":1,"forks_count":16,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-12T18:38:47.743Z","etag":null,"topics":["bdd","config","configuration","configuration-files","configuration-management","continuous-deployment","continuous-integration","env-loader","environment","environment-manager","environment-variables","environment-vars","hacktoberfest","java","keepass","overridden","properties","secrets","secrets-manager","sitture"],"latest_commit_sha":null,"homepage":"","language":"Java","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/sitture.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-10-02T12:29:55.000Z","updated_at":"2026-01-12T09:11:36.000Z","dependencies_parsed_at":"2023-11-13T11:28:58.881Z","dependency_job_id":"aa7b0a90-8541-4931-a029-c60fe6abcf76","html_url":"https://github.com/sitture/env-config","commit_stats":{"total_commits":212,"total_committers":8,"mean_commits":26.5,"dds":0.5283018867924528,"last_synced_commit":"618cb4445c2ddfd82ade47c5bd327f242c817c8b"},"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"purl":"pkg:github/sitture/env-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitture%2Fenv-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitture%2Fenv-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitture%2Fenv-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitture%2Fenv-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sitture","download_url":"https://codeload.github.com/sitture/env-config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitture%2Fenv-config/sbom","scorecard":{"id":379989,"data":{"date":"2025-08-11","repo":{"name":"github.com/sitture/env-config","commit":"88aca54f8f3cb14b71a0b986b8cf487d3654b98d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/2 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":10,"reason":"14 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/github-publish.yml:1","Warn: no topLevel permission defined: .github/workflows/maven-build.yml:1","Warn: no topLevel permission defined: .github/workflows/maven-publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/github-publish.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/sitture/env-config/github-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/github-publish.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/sitture/env-config/github-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/maven-build.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/sitture/env-config/maven-build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/maven-build.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/sitture/env-config/maven-build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/maven-publish.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/sitture/env-config/maven-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/maven-publish.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/sitture/env-config/maven-publish.yml/master?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/github-publish.yml:6"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-j288-q9x7-2f5v","Warn: Project is vulnerable to: GHSA-4cx2-fc23-5wg6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T15:10:58.820Z","repository_id":38016302,"created_at":"2025-08-18T15:10:58.821Z","updated_at":"2025-08-18T15:10:58.821Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29258782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T04:11:57.159Z","status":"ssl_error","status_checked_at":"2026-02-09T04:11:56.117Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["bdd","config","configuration","configuration-files","configuration-management","continuous-deployment","continuous-integration","env-loader","environment","environment-manager","environment-variables","environment-vars","hacktoberfest","java","keepass","overridden","properties","secrets","secrets-manager","sitture"],"created_at":"2026-02-09T07:39:53.020Z","updated_at":"2026-02-09T07:39:54.604Z","avatar_url":"https://github.com/sitture.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# env-config\n\nA simple utility to manage environment configs in Java-based projects by merging `*.properties` files with environment variables overrides.\n\n![Build](https://github.com/sitture/env-config/workflows/Build/badge.svg) ![Github Publish](https://github.com/sitture/env-config/workflows/Github%20Publish/badge.svg) ![Maven Publish](https://github.com/sitture/env-config/workflows/Maven%20Publish/badge.svg) [![Maven Central](https://img.shields.io/maven-central/v/com.github.sitture/env-config.svg)](https://mvnrepository.com/search?q=com.github.sitture) [![Maintainability](https://api.codeclimate.com/v1/badges/338645e6d3c853fcb93e/maintainability)](https://codeclimate.com/github/sitture/env-config/maintainability) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?maxAge=2592000)](https://opensource.org/licenses/MIT) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](../../issues)\n\nAll notable changes to this project are documented in [CHANGELOG.md](CHANGELOG.md).\nThe format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)\nand adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).\n\n## Setup\n\nAdd the following dependency to use this EnvConfig:\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.sitture\u003c/groupId\u003e\n    \u003cartifactId\u003eenv-config\u003c/artifactId\u003e\n    \u003cversion\u003e${version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Github Packages\n\nIf you would like to use github package instead of maven central, add the following repository to pom.xml.\n\n```xml\n\u003crepositories\u003e\n  \u003crepository\u003e\n    \u003cid\u003egithub\u003c/id\u003e\n    \u003cname\u003eGitHub Packages\u003c/name\u003e\n    \u003curl\u003ehttps://maven.pkg.github.com/sitture/env-config\u003c/url\u003e\n  \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\n### Gradle\n\n```groovy\ncompile 'com.github.sitture:env-config:${version}'\n```\n\n## Configuration\n\n| system property                        | environment variable                   | description                                                                                                                                               |\n|----------------------------------------|----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `env.config.path`                      | `ENV_CONFIG_PATH`                      | The base directory where the configuration files are lived. **default:** `config` directory under the project.                                            |\n| `env.config.environment`               | `ENV_CONFIG_ENVIRONMENT`               | The environment to activate. **default:** `default` directory under the base configuration directory.                                                     |\n| `env.config.profiles.path`             | `ENV_CONFIG_PROFILES_PATH`             | The base directory where the profile based configuration files are lived. **default:** `${env.config.path}/${env.config.environment}/`                    |\n| `env.config.profile`                   | `ENV_CONFIG_PROFILE`                   | The profile to activate from the active environment directory.                                                                                            |\n| `env.config.keepass.enabled`           | `ENV_CONFIG_KEEPASS_ENABLED`           | Whether to load properties from a keepass file. **default:** `false`                                                                                      |\n| `env.config.keepass.filename`          | `ENV_CONFIG_KEEPASS_FILENAME`          | The keepass filename to load from the resources folder (src/main/resources). **default:** the root project directory name. i.e. `project.build.directory` |\n| `env.config.keepass.masterkey`         | `ENV_CONFIG_KEEPASS_MASTERKEY`         | The password to open the keepass file. This is required if `env.config.keepass.enabled=true`.                                                             |\n| `env.config.vault.enabled`             | `ENV_CONFIG_VAULT_ENABLED`             | Whether to load properties from a vault secret. **default:** `false`                                                                                      |\n| `env.config.vault.address`             | `ENV_CONFIG_VAULT_ADDRESS`             | The host address of the vault instance. This is required if `env.config.vault.enabled=true`.                                                              |\n| `env.config.vault.namespace`           | `ENV_CONFIG_VAULT_NAMESPACE`           | The vault namespace to look for secrets. This is required if `env.config.vault.enabled=true`.                                                             |\n| `env.config.vault.default.secret.path` | `ENV_CONFIG_VAULT_DEFAULT_SECRET_PATH` | The base secret path for the project. This is optional when there's a shared secret across multiple projects.                                             |\n| `env.config.vault.secret.path`         | `ENV_CONFIG_VAULT_SECRET_PATH`         | The base secret path for the project. This is required if `env.config.vault.enabled=true`.                                                                |\n| `env.config.vault.token`               | `ENV_CONFIG_VAULT_TOKEN`               | The vault token used for authentication. This is required if `env.config.vault.enabled=true`.                                                             |\n\n## Configuration precedence\n\n1. Java System properties - `System.getProperties()`\n2. OS environment variables - `System.getenv()`\n3. Environment profile properties - `config/${env.config.environment}/${env.config.profile}/*.properties`\n4. Default profile properties - `config/default/${env.config.profile}/*.properties`\n5. Environment specific properties - `config/${env.config.environment}/*.properties`\n6. Default properties - `config/default/*.properties`\n\n## Usage\n\nTo start using this:\n\n### `config` directory\n\nThe default required directory for configuration files in `config` under project root. This can be overridden by `ENV_CONFIG_PATH` environment variable.\n\n* create a directory called `config` in project root.\n\n### `config` environments\n\nThe default environment is set to `default` and can be overridden by `ENV_CONFIG_ENVIRONMENT` environment variable.\n\n1. create a `default` environment subdirectory under `config` directory.\n2. create a `default.properties` file in the `default` directory. E.g. `config/default/default.properties`\n\n```bash\n# formatted as key=value\nmy.first.property=my_first_value\nmy.second.property=my_second_value\n```\n\nYou can add multiple `.properties` files under environment directory. E.g. You may want to split the properties into:\n\n```text\n.\n├── config\n│   └── default\n│       ├── default.properties\n│       └── db.properties\n```\n\n\u003eYou can create as many environments as needed.\n\n```text\n.\n├── config\n│   └── default\n│       ├── default.properties\n│       └── db.properties\n│   └── integration\n│       └── integration.properties\n```\n\n### `config` profiles\n\nYou can also have config profiles within an environment directory by specifying the `ENV_CONFIG_PROFILE=profile1` variable E.g.\n\n```text\n.\n├── config\n│   └── default\n│       └── profile1\n│           └── profile1.properties\n│       └── profile2\n│           └── profile2.properties\n│       └── default.properties\n│   └── integration\n│       └── profile1\n│           └── profile1.properties\n│       └── integration.properties\n```\n\nIf `ENV_CONFIG_ENVIRONMENT=integration` and `ENV_CONFIG_PROFILE=profile1` suggests to load properties in the following order:\n\n1. `integration/profile1/profile1.properties`\n2. `default/profile1/profile1.properties`\n3. `integration/integration.properties`\n4. `default/default.properties`\n\n### base environments\n\nYou can base an environment based on another by specifying multiple environment in `ENV_CONFIG_ENVIRONMENT` environment variable.\n\nE.g. if you would like `env2` environment to inherit properties from `env2` environment:\n\n```shell\nENV_CONFIG_ENVIRONMENT=env1,env2\n```\n\nThe above will load environment properties from env2 on top of env1 and finally the default properties from default environment.\n\n### `KeePass` Database Entries\n\nIf you have secret passwords which cannot be stored as plain text within project repository, you can store them into a password-protected [KeePass](https://keepass.info/) database file.\n\n1. create a keepass database file, add to your resources folder. i.e. `src/main/resources` or `src/test/resources`.\n\n#### Configurations\n\n* `ENV_CONFIG_KEEPASS_ENABLED` - A flag to enable reading of the keePass file. Default is set to `false`.\n* `ENV_CONFIG_KEEPASS_FILENAME` - This is the name of the DB file. Default is the name of project directory.\n* `ENV_CONFIG_KEEPASS_MASTERKEY` - The key to access the DB file.\n\n#### KeePass Groups\n\n* The top level group should have the same name as the DB filename. e.g. if DB file is `keepass.kdbx` then top level group should be `keepass`.\n* The sub-groups should match with the environment directory you have created above. For example, you should have `default` group for the default environment.\n* The entries within the `default` group will be shared across all environments similar to the environment directories behaviour.\n\n### Environment priority\n\nThe `EnvConfig` will go through properties set under your environment and then load properties from default environment ignoring the ones already set. You can keep the shared properties under your `default` environment without having to repeat them in every other environment.\n\n### Current environment\n\nYou can get the current environment by:\n\n```java\nEnvConfig.getEnvironment();\n```\n\n### Get property `EnvConfig.get(\"...\")`\n\nTo get a property set either in the properties file, system property or environment variable:\n\n```java\nEnvConfig.get(\"my.property\");\nEnvConfig.getInt(\"my.property\");\nEnvConfig.getBool(\"my.property\");\nEnvConfig.getList(\"my.property\"); // will return a List\u003cString\u003e from a comma separated String.\n```\n\n### Get `required` property\n\n```java\n// when a property is required to continue\nEnvConfig.getOrThrow(\"my.property\");\n```\n\nIf the property isn't set then a `EnvConfigException` is thrown.\n\n### Get property with `defaultValue`\n\n```java\n// return a default value when a property isn't found\nEnvConfig.get(\"my.property\", \"defaultValue\");\n```\n\n__Note:__ All the environment variable names are set to properties naming convention.\nE.g. `MY_ENV_VAR` can either be accessed by `EnvConfig.get(\"my.env.var\");` or `EnvConfig.get(\"MY_ENV_VAR\");`\n\n### Property overrides\n\nYou can override any property set in the environment properties file by setting an system environment variable.\n\nE.g. `my.env.property` can be overridden by `MY_ENV_PROPERTY` environment variable.\n\n### Add property `EnvConfig.add(\"...\")`\n\nYou can add key/value pairs to the EnvConfig to be accessed somewhere else in the project.\n\n```java\nEnvConfig.add(\"my.property\", \"my_value\");\n```\n\n### Set property `EnvConfig.set(\"...\")`\n\nYou can set/update an existing property in EnvConfig:\n\n```java\nEnvConfig.set(\"my.property\", \"my_value\");\n```\n\nThe `.set(...)` can be used for both existing and non-existing properties.\n\n### Clear property `EnvConfig.clear(\"...\")`\n\nYou can clear an existing property in EnvConfig:\n\n```java\nEnvConfig.clear(\"my.property\")\n```\n\n### Get all `EnvConfig.asMap()`\n\nYou can get a full list of available properties with `EnvConfig.asMap()` which is a combination of properties from `config` directory, system properties and all environment variables.\n\n## Issues \u0026 Contributions\n\nPlease [open an issue here](../../issues) on GitHub\nif you have a problem, suggestion, or other comment.\n\nPull requests are welcome and encouraged! Any contributions should include new or updated unit tests as necessary to maintain thorough test coverage.\n\nRead [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsitture%2Fenv-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsitture%2Fenv-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsitture%2Fenv-config/lists"}