mirror of
https://github.com/actix/examples
synced 2025-01-22 22:05:57 +01:00
24 lines
512 B
Rust
24 lines
512 B
Rust
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>;
|
|
}
|