1
0
mirror of https://github.com/actix/examples synced 2025-06-27 09:29:02 +02:00

refactor: use confik instead of config

This commit is contained in:
Rob Ede
2024-07-07 02:01:13 +01:00
parent 03879899a5
commit 0bdd5479ff
14 changed files with 322 additions and 477 deletions

View File

@ -0,0 +1,23 @@
use confik::Configuration;
use serde::Deserialize;
#[derive(Debug, Default, Configuration)]
pub struct ExampleConfig {
pub server_addr: String,
#[confik(from = DbConfig)]
pub pg: deadpool_postgres::Config,
}
#[derive(Debug, Deserialize)]
#[serde(transparent)]
struct DbConfig(deadpool_postgres::Config);
impl From<DbConfig> for deadpool_postgres::Config {
fn from(value: DbConfig) -> Self {
value.0
}
}
impl confik::Configuration for DbConfig {
type Builder = Option<Self>;
}