forked from github-starred/komodo
skip serializing for proper merge
This commit is contained in:
@@ -473,13 +473,13 @@ pub struct CliConfig {
|
||||
// Same as Core
|
||||
/// The host Komodo url.
|
||||
/// Eg. "https://demo.komo.do"
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "String::is_empty")]
|
||||
pub host: String,
|
||||
/// The api key for the CLI to use
|
||||
#[serde(alias = "key")]
|
||||
#[serde(alias = "key", skip_serializing_if = "Option::is_none")]
|
||||
pub cli_key: Option<String>,
|
||||
/// The api secret for the CLI to use
|
||||
#[serde(alias = "secret")]
|
||||
#[serde(alias = "secret", skip_serializing_if = "Option::is_none")]
|
||||
pub cli_secret: Option<String>,
|
||||
/// The root backups folder.
|
||||
///
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::path::PathBuf;
|
||||
use std::{path::PathBuf, sync::OnceLock};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
@@ -18,7 +18,7 @@ fn default_config_path() -> PathBuf {
|
||||
/// Must provide ONE of:
|
||||
/// 1. `uri`
|
||||
/// 2. `address` + `username` + `password`
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct DatabaseConfig {
|
||||
/// Full mongo uri string, eg. `mongodb://username:password@your.mongo.int:27017`
|
||||
#[serde(default)]
|
||||
@@ -66,6 +66,12 @@ impl Default for DatabaseConfig {
|
||||
}
|
||||
}
|
||||
|
||||
fn default_database_config() -> &'static DatabaseConfig {
|
||||
static DEFAULT_DATABASE_CONFIG: OnceLock<DatabaseConfig> =
|
||||
OnceLock::new();
|
||||
DEFAULT_DATABASE_CONFIG.get_or_init(Default::default)
|
||||
}
|
||||
|
||||
impl DatabaseConfig {
|
||||
pub fn sanitized(&self) -> DatabaseConfig {
|
||||
DatabaseConfig {
|
||||
@@ -77,6 +83,10 @@ impl DatabaseConfig {
|
||||
db_name: self.db_name.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_default(&self) -> bool {
|
||||
self == default_database_config()
|
||||
}
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct LogConfig {
|
||||
/// The logging level. default: info
|
||||
#[serde(default)]
|
||||
@@ -49,6 +51,17 @@ impl Default for LogConfig {
|
||||
}
|
||||
}
|
||||
|
||||
fn default_log_config() -> &'static LogConfig {
|
||||
static DEFAULT_LOG_CONFIG: OnceLock<LogConfig> = OnceLock::new();
|
||||
DEFAULT_LOG_CONFIG.get_or_init(Default::default)
|
||||
}
|
||||
|
||||
impl LogConfig {
|
||||
pub fn is_default(&self) -> bool {
|
||||
self == default_log_config()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug,
|
||||
Clone,
|
||||
|
||||
Reference in New Issue
Block a user