diff --git a/cmd/cgr-engine/cgr-engine.go b/cmd/cgr-engine/cgr-engine.go index 85d200105..e7542a59e 100644 --- a/cmd/cgr-engine/cgr-engine.go +++ b/cmd/cgr-engine/cgr-engine.go @@ -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 } diff --git a/services/cgr-engine.go b/services/cgr-engine.go index d36dbffa9..8059aa4ec 100644 --- a/services/cgr-engine.go +++ b/services/cgr-engine.go @@ -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 { diff --git a/services/libcgr-engine.go b/services/libcgr-engine.go index f56e90547..04c21fee2 100644 --- a/services/libcgr-engine.go +++ b/services/libcgr-engine.go @@ -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 diff --git a/services/libcgr-engine_test.go b/services/libcgr-engine_test.go index b80aa7105..08be953d8 100644 --- a/services/libcgr-engine_test.go +++ b/services/libcgr-engine_test.go @@ -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", }, diff --git a/utils/consts.go b/utils/consts.go index ab1deb611..24c992223 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -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"