Crate envy_store[][src]

Envy store provides a means to resolve a collection of AWS Parameter Store values at runtime required for an application to run and deserialize them into a type safe struct.

The idea here is that applications that may have previously used the 12-factor practice of storing configuration in environment variables, perhaps deserializing them using envy, are now configured using the same pattern but resolving values from AWS Parameter Store instead

This crate assumes you are using the AWS best practice of storing related parameters under a prefixed hierarchy. This leads to better clarity on what application a set of parameters belong to as well as enables the paths based query API which has performance benefits and is the recommended best practice by AWS.

This crate assumes the use of the AWS default credential chain for authenticating requests with AWS. Don't worry, if you've used any AWS tooling in the past, you likely already have this configured. You will also need to ensure these credentials have the ssm:GetParametersByPath IAM permission.

Example

extern crate envy_store;
#[macro_use]
extern crate serde_derive;

/// Type resolvable by prefixed parameter store values
/// aws ssm put-parameter --name /demo/foo --value bar --type SecureString
/// aws ssm put-parameter --name /demo/bar --value baz,boom,zoom --type StringList
/// aws ssm put-parameter --name /demo/zar --value 42 --type String
#[derive(Deserialize)]
struct Config {
  foo: String,
  bar: Vec<String>,
  zar: u32,
}

fn main() {
   // Returns a `Future` containing the result of a deserialized `Config` type
   let config = envy_store::from_path::<Config, _>(
     "/demo"
   );
}

Enums

Error

Represents possible errors

Functions

from_client

Resolves parameter store values and deserializes them into a typesafe struct. Similar to from_path but also accepts a customized rusoto_ssm::Ssm implementation

from_path

Resolves parameter store values and deserialize them into a typesafe struct