#configuration #binary #compiled #file #reading #configuring #executing

catconf

Allows for reading from the executing binary in order to pull configuration

3 releases

0.1.2 Apr 18, 2023
0.1.1 Apr 18, 2023
0.1.0 Apr 18, 2023

#857 in Configuration

AGPL-3.0-only

16KB
99 lines

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.


lib.rs:

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 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

No runtime deps