Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmine DiMascio committed Jan 1, 2018
1 parent e3f8f0c commit e1343b4
Showing 1 changed file with 64 additions and 27 deletions.
91 changes: 64 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Dotenv dotenv = Dotenv.load();
dotenv.get("MY_ENV_VAR1")
```

or with **Kotlin**
or with **Kotlin**

```kotlin
import io.github.cdimascio.dotenv.dotenv
Expand Down Expand Up @@ -102,38 +102,74 @@ dotenv.get("HOME");

or with **Kotlin**

```kotline
```kotlin
dotenv["MY_ENV_VAR1"]
dotenv["HOME"]
```

## Configuration options

### *optional* `directory(path: String)`
`path` specifies the directory containing `.env`. Dotenv first searches for `.env` using the given path on the filesystem. If not found, it searches the given path on the classpath. If `directory` is not specified it defaults to searching the current working directory on the filesystem. If not found, it searches the current directory on the classpath.

### *optional* `ignoreIfMalformed()`

Do not throw when `.env` entries are malformed. Malformed entries are skipped.

### *optional* `ignoreIfMissing()`

Do not throw when `.env` does not exist. Dotenv will continue to retrieve environment variables that are set in the environment e.g. `dotenv["HOME"]`

### *optional* `directory`
* `path` specifies the directory containing `.env`. Dotenv first searches for `.env` using the given path on the filesystem. If not found, it searches the given path on the classpath. If `directory` is not specified it defaults to searching the current working directory on the filesystem. If not found, it searches the current directory on the classpath.

**Java example**

```java
Dotenv
.configure()
.directory("/some/path")
.load()
```

**Kotlin Dsl example**

```java
dotenv {
directory = "/some/path"
}
```


### *optional* `ignoreIfMalformed`

* Do not throw when `.env` entries are malformed. Malformed entries are skipped.

**Java example**

```java
Dotenv
.configure()
.ignoreIfMalformed()
.load()
```
**Kotlin Dsl example**

```java
dotenv {
ignoreIfMalformed = true
}
```

### *optional* `ignoreIfMissing`

* Do not throw when `.env` does not exist. Dotenv will continue to retrieve environment variables that are set in the environment e.g. `dotenv["HOME"]`

**Java example**

```java
Dotenv
.configure()
.ignoreIfMissing()
.load()
```
**Kotlin Dsl example**

```java
dotenv {
ignoreIfMissing = true
}
```

## Kotlin Dsl Configuration Options


### *optional* `directory: String`
Specifies the directory containing `.env`. Dotenv first searches for `.env` using the given path on the filesystem. If not found, it searches the given path on the classpath. If `directory` is not specified it defaults to searching the current working directory on the filesystem. If not found, it searches the current directory on the classpath.

### *optional* `ignoreIfMalformed: Boolean`

Do not throw when `.env` entries are malformed. Malformed entries are skipped.

### *optional* `ignoreIfMissing: Boolean`

Do not throw when `.env` does not exist. Dotenv will continue to retrieve environment variables that are set in the environment e.g. `dotenv["HOME"]`

## Examples

Expand All @@ -149,4 +185,5 @@ Do not throw when `.env` does not exist. Dotenv will continue to retrieve enviro

## License

[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)

0 comments on commit e1343b4

Please sign in to comment.