refactor: remove explict cert file path from backend mods and define abstracted trait for the cert source preparing librarization

This commit is contained in:
Jun Kurihara 2023-07-12 21:40:08 +09:00
commit 05b2aab8b0
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
8 changed files with 55 additions and 60 deletions

View file

@ -1,12 +1,16 @@
use super::toml::ConfigToml;
use crate::{backend::Backends, certs::CryptoSource, error::*, globals::*, log::*, utils::BytesName};
use crate::{
backend::Backends,
cert_file_reader::CryptoFileSource,
error::{anyhow, ensure},
globals::*,
log::*,
utils::BytesName,
};
use clap::Arg;
use tokio::runtime::Handle;
pub fn build_globals<T>(runtime_handle: Handle) -> std::result::Result<Globals<T>, anyhow::Error>
where
T: CryptoSource + Clone,
{
pub fn build_globals(runtime_handle: Handle) -> std::result::Result<Globals<CryptoFileSource>, anyhow::Error> {
let _ = include_str!("../../Cargo.toml");
let options = clap::command!().arg(
Arg::new("config_file")