chore: add more fields to Config type (native-utils)
This commit is contained in:
parent
d6dd6ff897
commit
fb8a8614f4
1 changed files with 35 additions and 1 deletions
|
@ -3,12 +3,46 @@ use serde_yaml;
|
|||
use std::env;
|
||||
use std::fs;
|
||||
|
||||
/// TODO: add more fields
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[cfg_attr(feature = "napi", napi_derive::napi(object))]
|
||||
pub struct Config {
|
||||
pub url: String,
|
||||
pub db: DbConfig,
|
||||
pub redis: RedisConfig,
|
||||
pub cache_server: Option<RedisConfig>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
#[cfg_attr(feature = "napi", napi_derive::napi(object))]
|
||||
pub struct DbConfig {
|
||||
pub host: String,
|
||||
pub port: u32,
|
||||
pub db: String,
|
||||
pub user: String,
|
||||
pub pass: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
#[cfg_attr(feature = "napi", napi_derive::napi(object))]
|
||||
pub struct RedisConfig {
|
||||
pub host: String,
|
||||
pub port: u32,
|
||||
pub user: Option<String>,
|
||||
pub pass: Option<String>,
|
||||
pub tls: Option<TlsConfig>,
|
||||
#[serde(default)]
|
||||
pub db: u32,
|
||||
#[serde(default)]
|
||||
pub prefix: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[cfg_attr(feature = "napi", napi_derive::napi(object))]
|
||||
pub struct TlsConfig {
|
||||
pub host: String,
|
||||
pub reject_unauthorized: bool,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "napi", napi_derive::napi)]
|
||||
|
|
Loading…
Reference in a new issue