Ciris Integration for loading secrets from Credstash
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
project
src/main
.gitignore
LICENSE
README.md
build.sbt
version.sbt

README.md

Download

ciris-credstash

Ciris Integration for loading secrets from Credstash.

Setup

To use ciris-credstash, add the following artifact to your dependencies:

libraryDependencies += "com.ovoenergy" %% "ciris-credstash" %% VERSION

Dependencies

This integration depends on aws-java-sdk-core and JCredstash.

Example

import ciris._
import ciris.credstash._

case class TestConfig(credstashSecret: String)

object Example {
  val res = loadConfig(
    credstash[String]()("uat.twilio.auth_token")
  ) { (secret: String) =>
    TestConfig(secret)
  }
}

The AWS credentials and region can be configured by passing an AwsCredentialsProvider and/or an AwsRegionProvider.

import ciris._
import ciris.credstash._
import com.amazonaws.regions.DefaultAwsRegionProviderChain
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain

case class TestConfig(credstashSecret: String)

object Example {
  val res = loadConfig(
    credstash[String](awsCredentialProvider = new DefaultAWSCredentialsProviderChain,
                      awsRegionProvider = new DefaultAwsRegionProviderChain)("uat.twilio.auth_token")
  ) { (secret: String) =>
    TestConfig(secret)
  }
}