Crates.io | catconf |
lib.rs | catconf |
version | 0.1.2 |
source | src |
created_at | 2023-04-18 04:06:50.231069 |
updated_at | 2023-04-18 04:12:11.866479 |
description | Allows for reading from the executing binary in order to pull configuration |
homepage | |
repository | |
max_upload_size | |
id | 842104 |
size | 46,046 |
For when you want:
This library allows for taking the final result binary, and just concatenating the configuration to the end:
cat target/debug/binary <(echo -n "CATCONF") conf > confedbinary
Great, but how to get the configuration back out and use it in the code? catconf!
It’s use is pretty simple:
use catconf::ConfReaderOptions;
let conf_reader = ConfReaderOptions::new(b"CATCONF".to_vec()).read_from_exe()?;
This returns a Vec<u8>
which can be transformed further, by converting to UTF-8 and combined with Serde, decompressing with zlib, etc.