github.com/vseinstrumentiru/lego@v1.0.2/internal/lego/monitor/log/config.go (about)

     1  package log
     2  
     3  import (
     4  	"github.com/spf13/pflag"
     5  	"github.com/spf13/viper"
     6  	"os"
     7  )
     8  
     9  type Config struct {
    10  	Format    string
    11  	Level     string
    12  	NoColor   bool
    13  	UseStack  bool
    14  	SkipStack int
    15  }
    16  
    17  func (c Config) SetDefaults(env *viper.Viper, flag *pflag.FlagSet) {
    18  	env.SetDefault("srv.monitor.log.format", "json")
    19  	env.SetDefault("srv.monitor.log.level", "debug")
    20  	env.SetDefault("srv.monitor.log.skipStack", 4)
    21  
    22  	if _, ok := os.LookupEnv("NO_COLOR"); ok {
    23  		env.SetDefault("no_color", true)
    24  	}
    25  
    26  	env.RegisterAlias("srv.log.noColor", "no_color")
    27  }
    28  
    29  func (c *Config) Validate() (err error) {
    30  	return
    31  }