/ciris-credstash

Ciris Integration for loading secrets from Credstash

Primary LanguageScalaMIT LicenseMIT

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)
  }
}