Ciris AWS Secrets Manager
AWS Secrets Manager support for Ciris.
This module is heavily derived from the existing Ciris SSM module.
Getting Started
To get started with sbt, simply add the following lines to your build.sbt
file.
For Cats Effect 3:
libraryDependencies += "com.ovoenergy" %% "ciris-aws-secretsmanager" % "5.0.1"
For Cats Effect 2:
libraryDependencies += "com.ovoenergy" %% "ciris-aws-secretsmanager" % "4.0.0"
The library is published for Scala 2.12, 2.13 and 3.1.
Example
import cats.effect.{Blocker, ExitCode, IO, IOApp}
import cats.implicits._
import ciris._
import ciris.aws.secretsmanager._
final case class Passwords(
dbPassword: Secret[String],
apiKey: Secret[String],
)
object Main extends IOApp {
def run(args: List[String]): IO[ExitCode] = {
val password =
for {
region <- env("AWS_REGION").as[Region].default(Region.EU_WEST_1)
secret <- secrets(region)
passwords <- (
secret(key = "db-password-prod", version = "1.0"),
secret(key = "api-key", version = "1.0")
).parMapN { (dbPassword, apiKey) =>
Passwords(
dbPassword = dbPassword,
apiKey = apiKey
)
}
} yield passwords
password.load[IO].as(ExitCode.Success)
}
}
Release
To release a new version, use the following command.
$ sbt release