全局配置、钱包配置等。
GlobalConfig
/// Going to hold all of the various configuration types
/// separately for now, then put them together as a single
/// ServerConfig object afterwards. This is to flatten
/// out the configuration file into logical sections,
/// as they tend to be quite nested in the code
/// Most structs optional, as they may or may not
/// be needed depending on what's being run
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct GlobalConfig {
/// Keep track of the file we've read
pub config_file_path: Option<PathBuf>,
/// Global member config
pub members: Option<ConfigMembers>,
}
ConfigMembers
/// Keeping an 'inner' structure here, as the top
/// level GlobalConfigContainer options might want to keep
/// internal state that we don't necessarily
/// want serialised or deserialised
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct ConfigMembers {
/// Server config
#[serde(default)]
pub server: ServerConfig,
/// Mining config
pub mining_server: Option<StratumServerConfig>,
/// Logging config
pub logging: Option<LoggingConfig>,
/// Wallet config. May eventually need to be moved to its own thing. Or not.
/// Depends on whether we end up starting the wallet in its own process but
/// with the same lifecycle as the server.
#[serde(default)]
pub wallet: WalletConfig,
}
GlobalWalletConfig
/// Wallet should be split into a separate configuration file
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct GlobalWalletConfig {
/// Keep track of the file we've read
pub config_file_path: Option<PathBuf>,
/// Wallet members
pub members: Option<GlobalWalletConfigMembers>,
}
GlobalWalletConfigMembers
/// Wallet internal members
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct GlobalWalletConfigMembers {
/// Wallet configuration
#[serde(default)]
pub wallet: WalletConfig,
/// Logging config
pub logging: Option<LoggingConfig>,
}