Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
npryce committed Jun 8, 2018
1 parent b4a1de2 commit 6738fca
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ To get started, add `com.natpryce:konfig:<version>` as a dependency, import `com
1. Define typed property keys

```kotlin
object server : PropertyGroup() {
val port by intType
val host by stringType
}
val port by intType
val host by stringType
```

2. Build a Configuration object that loads properties:
Expand All @@ -51,14 +49,14 @@ To get started, add `com.natpryce:konfig:<version>` as a dependency, import `com
3. Define some properties. For example, in `defaults.properties`:

```properties
server.port=8080
server.host=0.0.0.0
port=8080
host=0.0.0.0
```

4. Look up properties by key. They are returned as typed values, not strings, and so can be used directly:

```kotlin
val server = Server(config[server.port], config[server.host])
val server = Server(config[port], config[host])
server.start()
```

Expand Down

0 comments on commit 6738fca

Please sign in to comment.