nitrogen 0.2.5

Nitrogen is a tool for deploying web services to AWS Nitro Enclaves.
use std::{fs, path::Path};

fn main() {
    let mut cf_template = fs::read_to_string("src/templates/setupTemplate.json")
        .expect("Something went wrong reading the CloudFormation template.");
    cf_template.pop(); // setupTemplate.json has newline character at the end

    let cf_template_const = format!(
        "{}\n{}{}\n{}\n",
        r"// AUTO-GENERATED CODE. DO NOT EDIT THIS FILE.",
        r#"pub const SETUP_TEMPLATE: &str = r##""#,
        cf_template,
        r###""##;"###,
    );
    let dest_path = Path::new("src").join("template.rs");

    fs::write(&dest_path, cf_template_const).unwrap();
    println!("cargo:rerun-if-changed=src/templates/setupTemplate.json");
    println!("cargo:rerun-if-changed=build.rs");
}