germinate 0.3.0

A templating library for injecting variables from multiple external sources
docs.rs failed to build germinate-0.3.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: germinate-0.7.0

Germinate

Crates.io docs.rs GitHub Workflow Status (branch) Crates.io

A templating library for injecting variables from multiple external sources

Library

Example

This is a simple example showing how to pull values from the environment

use germinate::Seed;

#[tokio::main]
async fn main() {
    std::env::set_var("NAME", "John Wick");
    let mut seed = Seed::new("Hi %env:NAME%!".into());
    let output = seed.germinate().await.unwrap();

    assert_eq!(String::from("Hi John Wick!"), output);
}

Binary

Germinate provides a CLI for templating files, available from the Github releases. To run the CLI, cimply download the binary for your system and check the usage with germinate --help

Example

The CLI can be used to parse an template file and output it either to stdout or optionally, an output file

# To print the parsed result to stdout
germinate myfile.txt.tmpl

# To write the output to a file
germinate myfile.txt.tmpl -o myfile.txt

Sources

Currently implemented sources:

  • env - Load values from environment variables
  • awsssm - Load values from the AWS Systems Manager Parameter Store
    • This source requires the ssm:GetParameter AWS IAM permission
  • awsec2metadata - Load values from the AWS EC2 Metadata Service
  • awsec2tag - Load values from an EC2 instance's tags. This can only access tags on the instance running germinate
    • This source requires the instance to have the ec2:DescribeInstances AWS IAM permission

Custom sources

For an example of integrating your own value source, checkout the Seed struct in the docs

License

GPL-3.0