Add constructor
This commit is contained in:
parent
c0f0f4d3ec
commit
ee8a6a913d
@ -66,7 +66,13 @@ pub trait ReadCredential {
|
||||
#[derive(Debug)]
|
||||
pub struct ReadCredDir<R: ReadEnv = EnvPath>(R);
|
||||
|
||||
impl<R: ReadEnv> ReadCredential for ReadCredDir<R> {
|
||||
impl<R: ReadEnv> ReadCredDir<R> {
|
||||
pub fn new(env_reader: R) -> Self {
|
||||
Self(env_reader)
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: ReadEnv> ReadCredential for ReadCredDir<R> {
|
||||
fn read_credential(&self, name: &str) -> Result<Option<String>> {
|
||||
let credentials_dir = self.0.read_env(CREDENTIALS_DIRECTORY);
|
||||
let Ok(creds_dir) = credentials_dir.map(PathBuf::from) else {
|
||||
|
Loading…
Reference in New Issue
Block a user