oxyde_cloud_cli/
api_key.rs

1use keyring::{Entry, Result};
2
3#[inline(always)]
4pub fn api_key_entry() -> Result<Entry> {
5    Entry::new("oxyde-cloud", "api-key")
6}
7
8pub fn api_key() -> Result<String> {
9    if let Ok(api_key) = std::env::var("OXYDE_CLOUD_API_KEY") {
10        Ok(api_key)
11    } else {
12        api_key_entry()?.get_password()
13    }
14}