catconf

Crates.iocatconf
lib.rscatconf
version0.1.2
sourcesrc
created_at2023-04-18 04:06:50.231069
updated_at2023-04-18 04:12:11.866479
descriptionAllows for reading from the executing binary in order to pull configuration
homepage
repository
max_upload_size
id842104
size46,046
Andrew Rioux (r-a303931)

documentation

README

Catconf

For when you want:

  1. Runtime configuration for after the binary is compiled
  2. A single file binary

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.

Commit count: 0

cargo fmt