github.com/Rookout/GoSDK@v0.1.48/pkg/config/rook_options.go (about)

     1  package config
     2  
     3  type RookOptions struct {
     4  	Token       string
     5  	Host        string
     6  	Port        int
     7  	Proxy       string
     8  	Debug       bool
     9  	LogLevel    string
    10  	LogToStderr bool
    11  	LogToFile   bool
    12  	LogFile     string
    13  	GitCommit   string
    14  	GitOrigin   string
    15  	GitSources  map[string]string
    16  	LiveTail    bool
    17  	Labels      map[string]string
    18  	Quiet       bool
    19  }
    20  
    21  func UpdateFromOpts(opts RookOptions) {
    22  	UpdateConfig(func(config *DynamicConfiguration) {
    23  		if opts.LogLevel != "" {
    24  			config.LoggingConfiguration.LogLevel = opts.LogLevel
    25  		}
    26  
    27  		if opts.LogFile != "" {
    28  			config.LoggingConfiguration.FileName = opts.LogFile
    29  		}
    30  
    31  		config.LoggingConfiguration.LogToStderr = opts.LogToStderr
    32  
    33  		if opts.Debug {
    34  			config.LoggingConfiguration.Debug = true
    35  			config.LoggingConfiguration.LogLevel = "DEBUG"
    36  			config.LoggingConfiguration.LogToStderr = true
    37  		}
    38  
    39  		if opts.Quiet {
    40  			config.LoggingConfiguration.Quiet = opts.Quiet
    41  		}
    42  	})
    43  }