...

Source file src/edge-infra.dev/pkg/sds/devices/agent/config.go

Documentation: edge-infra.dev/pkg/sds/devices/agent

     1  package agent
     2  
     3  import (
     4  	"flag"
     5  )
     6  
     7  // Device Agent Configuration
     8  type Config struct {
     9  	ClassesPath string
    10  	LogLevel    string
    11  	EnablePprof bool
    12  	Workers     int
    13  	StartServer bool
    14  }
    15  
    16  // queueWorkers is number of workers to process device updates
    17  var defaultQueueWorkers = 3
    18  
    19  // BindFlags will bind the arguments/env vars to the configuration struct
    20  func (cfg *Config) BindFlags(fs *flag.FlagSet) {
    21  	fs.StringVar(
    22  		&cfg.ClassesPath,
    23  		"classes-path",
    24  		"/etc",
    25  		"path to device persistence dir",
    26  	)
    27  	fs.StringVar(
    28  		&cfg.LogLevel,
    29  		"log-level",
    30  		"info",
    31  		"log level for device agent",
    32  	)
    33  	fs.IntVar(
    34  		&cfg.Workers,
    35  		"workers",
    36  		defaultQueueWorkers,
    37  		"number of workers to handle device event updates",
    38  	)
    39  	fs.BoolVar(
    40  		&cfg.EnablePprof,
    41  		"pprof",
    42  		false,
    43  		"enables pprof endpoint",
    44  	)
    45  	fs.BoolVar(
    46  		&cfg.StartServer,
    47  		"start",
    48  		true,
    49  		"indicates whether to start the device agent server or exit gracefully",
    50  	)
    51  }
    52  

View as plain text