Function etoml::decrypt_default
source · pub fn decrypt_default<V>() -> Result<V, EtomlError>where
V: Serialize + for<'a> Deserialize<'a> + DeserializeOwned,
Expand description
Returns the decrypted secrets deserialized into the given type.
It expects to find the “secrets.etoml” in the same directory as from where the process is running. And it looks for the private key in the default location /opt/etoml/keys
Example
ⓘ
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
struct AppSecrets {
github: String
}
fn main() -> Result<(), etoml::EtomlError> {
let secrets = etoml::decrypt_default::<AppSecrets>()?;
println!("Github key: {}", secrets.github);
Ok(())
}