added preboot doc-comms
parent
97bc91ffcd
commit
939bdc6676
|
|
@ -4,6 +4,18 @@ use anyhow::{Result, Ok, Error};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
/// # Enum `MetricsPrebootParams`
|
||||||
|
/// ## for setting up metrics mode as preboot param from command prompt
|
||||||
|
///
|
||||||
|
/// examples:
|
||||||
|
/// ```
|
||||||
|
/// noxis-rs ... --metrics full
|
||||||
|
/// noxis-rs ... --metrics system
|
||||||
|
/// noxis-rs ... --metrics processes
|
||||||
|
/// noxis-rs ... --metrics net
|
||||||
|
/// noxis-rs ... --metrics none
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
#[derive(clap::ValueEnum, Debug, Clone)]
|
#[derive(clap::ValueEnum, Debug, Clone)]
|
||||||
pub enum MetricsPrebootParams {
|
pub enum MetricsPrebootParams {
|
||||||
Full,
|
Full,
|
||||||
|
|
@ -13,6 +25,8 @@ pub enum MetricsPrebootParams {
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// # `std::fmt::Display` implementation for `MetricsPrebootParams`
|
||||||
|
/// ## to enable parsing object to String
|
||||||
impl std::fmt::Display for MetricsPrebootParams {
|
impl std::fmt::Display for MetricsPrebootParams {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
|
|
@ -25,6 +39,71 @@ impl std::fmt::Display for MetricsPrebootParams {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// # struct `PrebootParams`
|
||||||
|
/// ## to parse and set up all modes as preboot params from command prompt
|
||||||
|
///
|
||||||
|
/// ### args :
|
||||||
|
///
|
||||||
|
/// `--no-hagent` - to disable hagent work module and set up work mode as autonomous
|
||||||
|
/// ### usage :
|
||||||
|
/// ```
|
||||||
|
/// noxis-rs ... --no-hagent ...
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// `--no-logs` - to disable logging at all
|
||||||
|
/// ### usage :
|
||||||
|
/// ```
|
||||||
|
/// noxis-rs ... --no-logs ...
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// `--refresh-logs` - to truncate logs directory
|
||||||
|
/// ### usage :
|
||||||
|
/// ```
|
||||||
|
/// noxis-rs ... --refresh-logs ...
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// `--no-remote-config` - to disable work with Redis as config producer
|
||||||
|
/// ### usage :
|
||||||
|
/// ```
|
||||||
|
/// noxis-rs ... --no-remote-config ...
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// `--no-sub` - to disable Redis subscribtion mechanism
|
||||||
|
/// ### usage :
|
||||||
|
/// ```
|
||||||
|
/// noxis-rs ... --no-sub ...
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// `--socket-path` - to set Unix Domain Socket file's directory
|
||||||
|
/// ### usage :
|
||||||
|
/// ```
|
||||||
|
/// noxis-rs ... --no-sub ...
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// `--log-to` - to set directory for logs
|
||||||
|
/// ### usage :
|
||||||
|
/// ```
|
||||||
|
/// noxis-rs ... --log-to /dir/to/logs/ ...
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// `--remote-server-url` - to set Redis Server
|
||||||
|
/// ### usage :
|
||||||
|
/// ```
|
||||||
|
/// noxis-rs ... --remote-server-url 192.168.28.12 ...
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// `--config` - to set Noxis' config full path
|
||||||
|
/// ### usage :
|
||||||
|
/// ```
|
||||||
|
/// noxis-rs ... --config /etc/enode/settings.json ...
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// `--metrics` - to set metrics mode
|
||||||
|
/// ### usage :
|
||||||
|
/// ```
|
||||||
|
/// noxis-rs ... --metrics full ...
|
||||||
|
/// ```
|
||||||
#[derive(Debug, Parser)]
|
#[derive(Debug, Parser)]
|
||||||
pub struct PrebootParams {
|
pub struct PrebootParams {
|
||||||
// actions
|
// actions
|
||||||
|
|
@ -102,6 +181,8 @@ pub struct PrebootParams {
|
||||||
pub metrics: MetricsPrebootParams,
|
pub metrics: MetricsPrebootParams,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// # implementation for `MetricsPrebootParams`
|
||||||
|
/// ## to enable validation mechanism
|
||||||
impl PrebootParams {
|
impl PrebootParams {
|
||||||
pub fn validate(mut self) -> Result<Self> {
|
pub fn validate(mut self) -> Result<Self> {
|
||||||
if !self.socket_path.exists() && !self.no_hostagent {
|
if !self.socket_path.exists() && !self.no_hostagent {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue