The rust project config with aes encrypt function
You can pass all parameters through optional flags ```bash
./target/release/configcli -p config.toml -s "abcdefghijklmnopqrstuvwxyz123456" -n encryptconfig.toml -f toml encrypt
./target/release/configcli -p encryptconfig.toml -s "abcdefghijklmnopqrstuvwxyz123456" -n encrypt_config.plain.toml -f toml decrypt ```
You can also pass the key through the environment variable AES_CONFIG_KEY
.
```bash
export AESCONFIGKEY=abcdefghijklmnopqrstuvwxyz123456
./target/release/configcli -p config.toml -n encryptconfig.toml -f toml encrypt
./target/release/configcli -p encryptconfig.toml -n encrypt_config.plain.toml -f toml decrypt ```
```rust use aes_config::ConfigType; use serde::Deserialize; use std::fmt::Debug;
struct Config { port: u16, name: String, }
/* config.toml file: port=10086 name="test"
encrypt_config.toml file: qOOX56hXnadNC5uHU36IgB1i/2OKgfgXz4PmDYmy683qUewVqsg= */
fn main() {
let salt = "abcdefghijklmnopqrstuvwxyz123456".tostring();
let c = aesconfig::ConfigInfo::new(
"examples/encryptconfig.toml".tostring(),
Some(salt),
ConfigType::TOML,
)
.unwrap();
println!("{:#?}", c.trygetconfig::
```