kanidm/libs/profiles/build.rs
dependabot[bot] 113258d523
chore(deps): bump base64 from 0.13.1 to 0.21.0 (#1350)
* chore(deps): bump base64 from 0.13.1 to 0.21.0

Bumps [base64](https://github.com/marshallpierce/rust-base64) from 0.13.1 to 0.21.0.
- [Release notes](https://github.com/marshallpierce/rust-base64/releases)
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.13.1...v0.21.0)

---
updated-dependencies:
- dependency-name: base64
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* base64 fixes

* fmt fixes

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
2023-03-06 13:57:21 +10:00

25 lines
776 B
Rust

use std::path::PathBuf;
use std::{env, fs};
use base64::{engine::general_purpose, Engine as _};
fn main() {
println!("cargo:rerun-if-env-changed=KANIDM_BUILD_PROFILE");
let profile = env::var("KANIDM_BUILD_PROFILE").unwrap_or_else(|_| "developer".to_string());
let profile_path: PathBuf = ["./", format!("{}.toml", profile).as_str()]
.iter()
.collect();
let data =
fs::read(&profile_path).unwrap_or_else(|_| panic!("Failed to read {:?}", profile_path));
let contents = general_purpose::STANDARD.encode(data);
println!("cargo:rerun-if-changed={}", profile_path.to_str().unwrap());
println!("cargo:rustc-env=KANIDM_BUILD_PROFILE={}", profile);
println!("cargo:rustc-env=KANIDM_BUILD_PROFILE_TOML={}", contents);
}