Skip to content

Commit

Permalink
docs(README): adapt to lazy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingwersaft committed Jul 10, 2020
1 parent d81ec74 commit ba63925
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,24 @@ Usage example in you build script:

```kotlin
import com.liftric.vault.vault
import com.liftric.vault.GetVaultSecretTask

plugins {
id("com.liftric.vault-client-plugin") version ("<latest>")
}
vault {
vaultAddress = "http://localhost:8200"
vaultToken = "myroottoken" // don't do that in production code!
vaultTokenFilePath = "${System.getProperty("user.home")}/.vault-token" // from file is prefered over vaultToken
maxRetries = 2
retryIntervalMilliseconds = 200
vaultAddress.set("http://localhost:8200")
vaultToken.set("myroottoken") // don't do that in production code!
vaultTokenFilePath.set("${System.getProperty("user.home")}/.vault-token") // from file is prefered over vaultToken
maxRetries.set(2)
retryIntervalMilliseconds.set(200)
}
tasks {
val needsSecrets by creating {
val secrets: Map<String, String> = project.vault("secret/example")
val needsSecrets by creating(GetVaultSecretTask::class) {
secretPath.set("secret/example")
doLast {
val secrets: Map<String, String> = secret.get()
}
}
}
```
Expand Down Expand Up @@ -68,10 +72,17 @@ import com.liftric.vault.vault
import org.gradle.api.Project

object Configs {
fun Project.secretStuff(): String {
fun Project.secretStuff(): Any {
val secrets = project.vault("secret/example")
[...] // use the secrets
}
fun Project.secretStuff(): Any {
val needsSecrets: GetVaultSecretTask = tasks.getByName<GetVaultSecretTask>("needsSecrets").apply {
execute()
}
val secret = needsSecrets.secret.get()
[...] // use the secrets
}
}
```
This can be used in your build scripts like:
Expand Down

0 comments on commit ba63925

Please sign in to comment.