Revise flag names/usage descriptions

This commit is contained in:
ionutboangiu
2024-10-31 19:06:42 +02:00
committed by Dan Christian Bogos
parent 78ae609f1d
commit 4b427aeaf6
5 changed files with 21 additions and 21 deletions

View File

@@ -49,7 +49,7 @@ func RunCGREngine(fs []string) (err error) {
return
}
}
if *flags.Singlecpu {
if *flags.SingleCPU {
runtime.GOMAXPROCS(1) // Having multiple cpus may slow down computing due to CPU management, to be reviewed in future Go releases
}

View File

@@ -354,9 +354,9 @@ func (cgr *CGREngine) Init(ctx *context.Context, shtDw context.CancelFunc, flags
}
}
if *flags.ScheduledShutDown != utils.EmptyString {
if *flags.ScheduledShutdown != utils.EmptyString {
var shtDwDur time.Duration
if shtDwDur, err = utils.ParseDurationWithNanosecs(*flags.ScheduledShutDown); err != nil {
if shtDwDur, err = utils.ParseDurationWithNanosecs(*flags.ScheduledShutdown); err != nil {
return
}
cgr.shdWg.Add(1)
@@ -374,7 +374,7 @@ func (cgr *CGREngine) Init(ctx *context.Context, shtDw context.CancelFunc, flags
// init syslog
if utils.Logger, err = engine.NewLogger(ctx,
utils.FirstNonEmpty(*flags.SysLogger, cgr.cfg.LoggerCfg().Type),
utils.FirstNonEmpty(*flags.Logger, cgr.cfg.LoggerCfg().Type),
cgr.cfg.GeneralCfg().DefaultTenant,
cgr.cfg.GeneralCfg().NodeID,
cgr.cM, cgr.cfg); err != nil {

View File

@@ -45,20 +45,20 @@ func NewCGREngineFlags() *CGREngineFlags {
fs := flag.NewFlagSet(utils.CgrEngine, flag.ExitOnError)
return &CGREngineFlags{
FlagSet: fs,
CfgPath: fs.String(utils.CfgPathCgr, utils.ConfigPath, "Configuration directory path."),
Version: fs.Bool(utils.VersionCgr, false, "Prints the application version."),
PidFile: fs.String(utils.PidCgr, utils.EmptyString, "Write pid file"),
CfgPath: fs.String(utils.CfgPathCgr, utils.ConfigPath, "Configuration directory path"),
Version: fs.Bool(utils.VersionCgr, false, "Print application version and exit"),
PidFile: fs.String(utils.PidCgr, utils.EmptyString, "Path to write the PID file"),
CpuPrfDir: fs.String(utils.CpuProfDirCgr, utils.EmptyString, "Directory for CPU profiles"),
MemPrfDir: fs.String(utils.MemProfDirCgr, utils.EmptyString, "Directory for memory profiles"),
MemPrfInterval: fs.Duration(utils.MemProfIntervalCgr, 15*time.Second, "Interval between memory profile saves"),
MemPrfMaxF: fs.Int(utils.MemProfMaxFilesCgr, 1, "Number of memory profiles to keep (most recent)"),
MemPrfTS: fs.Bool(utils.MemProfTimestampCgr, false, "Add timestamp to memory profile files"),
ScheduledShutDown: fs.String(utils.ScheduledShutdownCgr, utils.EmptyString, "shutdown the engine after this duration"),
Singlecpu: fs.Bool(utils.SingleCpuCgr, false, "Run on single CPU core"),
SysLogger: fs.String(utils.LoggerCfg, utils.EmptyString, "logger <*syslog|*stdout>"),
NodeID: fs.String(utils.NodeIDCfg, utils.EmptyString, "The node ID of the engine"),
LogLevel: fs.Int(utils.LogLevelCfg, -1, "Log level (0-emergency to 7-debug)"),
Preload: fs.String(utils.PreloadCgr, utils.EmptyString, "LoaderIDs used to load the data before the engine starts"),
ScheduledShutdown: fs.String(utils.ScheduledShutdownCgr, utils.EmptyString, "Shutdown the engine after the specified duration"),
SingleCPU: fs.Bool(utils.SingleCpuCgr, false, "Run on a single CPU core"),
Logger: fs.String(utils.LoggerCfg, utils.EmptyString, "Logger type <*syslog|*stdout|*kafkaLog>"),
NodeID: fs.String(utils.NodeIDCfg, utils.EmptyString, "Node ID of the engine"),
LogLevel: fs.Int(utils.LogLevelCfg, -1, "Log level (0=emergency to 7=debug)"),
Preload: fs.String(utils.PreloadCgr, utils.EmptyString, "Loader IDs used to load data before engine starts"),
CheckConfig: fs.Bool(utils.CheckCfgCgr, false, "Verify the config without starting the engine"),
SetVersions: fs.Bool(utils.SetVersionsCgr, false, "Overwrite database versions (equivalent to cgr-migrator -exec=*set_versions)"),
}
@@ -75,9 +75,9 @@ type CGREngineFlags struct {
MemPrfInterval *time.Duration
MemPrfMaxF *int
MemPrfTS *bool
ScheduledShutDown *string
Singlecpu *bool
SysLogger *string
ScheduledShutdown *string
SingleCPU *bool
Logger *string
NodeID *string
LogLevel *int
Preload *string

View File

@@ -95,21 +95,21 @@ func TestCgrEngineFlags(t *testing.T) {
{
name: "scheduledShutdown",
flags: []string{"-scheduled_shutdown", "1h"},
flagVar: ngFlags.ScheduledShutDown,
flagVar: ngFlags.ScheduledShutdown,
defaultVal: "",
want: "1h",
},
{
name: "singleCPU",
flags: []string{"-singlecpu"},
flagVar: ngFlags.Singlecpu,
flags: []string{"-single_cpu"},
flagVar: ngFlags.SingleCPU,
defaultVal: false,
want: true,
},
{
name: "syslogger",
flags: []string{"-logger", "*stdout"},
flagVar: ngFlags.SysLogger,
flagVar: ngFlags.Logger,
defaultVal: "",
want: "*stdout",
},

View File

@@ -2717,7 +2717,7 @@ const (
MemProfMaxFilesCgr = "memprof_maxfiles"
MemProfTimestampCgr = "memprof_timestamp"
ScheduledShutdownCgr = "scheduled_shutdown"
SingleCpuCgr = "singlecpu"
SingleCpuCgr = "single_cpu"
PreloadCgr = "preload"
SetVersionsCgr = "set_versions"
MemProfFinalFile = "mem_final.prof"