diff --git a/README.md b/README.md index 230e722..e5a9263 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,14 @@ Use `dotenv.get("...")` instead of Java's `System.getenv(...)`. io.github.cdimascio java-dotenv - 4.0.1 + 4.1.0 ``` ### Gradle ```groovy -compile 'io.github.cdimascio:java-dotenv:4.0.1' +compile 'io.github.cdimascio:java-dotenv:4.1.0' ``` ## Usage @@ -135,6 +135,27 @@ dotenv["HOME"] dotenv["MY_ENV_VAR1"] ?: "default value" ``` +### Iterate over environment variables +Note, environment variables specified in the host environment take precedence over those in `.env`. + +With **Java** + +```java +for (DotenvEntry e : dotenv) { + System.out.println(e.getKey()); + System.out.println(e.getValue()); +} +``` + +or with **Kotlin** + +```kotlin +for (e in env) { + println(e.key) + println(e.value) +} +``` + ## Configuration options ### *optional* `directory`