1
0
mirror of https://github.com/actix/examples synced 2025-01-23 06:14:35 +01:00

24 lines
512 B
Rust
Raw Normal View History

2024-07-07 02:01:13 +01:00
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>;
}