Allows fetching Docker Swarm secrets with Hoplite.
Available either through my personal repo, or GitHub Packages.
repositories {
maven("https://repo.stashy.dev/releases")
}
dependencies {
implementation("dev.stashy.hoplite.swarm:hoplite-swarm:<version>")
}
To allow fetching Swarm secrets, just add the SwarmSecretPreprocessor()
to your config loader.
val config = ConfigLoaderBuilder.default()
.addPreprocessor(SwarmSecretPreprocessor())
// ...
.build()
.loadConfigOrThrow<YourConfig>()
Then, to use your secret, prefix your secret name with swarm://
.
services:
hello-world:
image: hello-world:latest
secrets:
- SECRET1
environment:
secret1: "swarm://SECRET1"
Keep in mind that this does not support the _FILE
environment name convention common in other projects.