Repository: DiceDB/dice
File: config/config.go (Go)

Code before:
)

type Config struct {
	Server struct {
		Addr                   string        `mapstructure:"addr"`
		Port                   int           `mapstructure:"port"`
		KeepAlive              int32         `mapstructure:"keepalive"`
		Timeout                int32         `mapstructure:"timeout"`
		MaxConn                int32         `mapstructure:"max-conn"`
		ShardCronFrequency     time.Duration `mapstructure:"shardcronfrequency"`
		MultiplexerPollTimeout time.Duration `mapstructure:"servermultiplexerpolltimeout"`
		MaxClients             int           `mapstructure:"maxclients"`
		MaxMemory              int64         `mapstructure:"maxmemory"`
		EvictionPolicy         string        `mapstructure:"evictionpolicy"`
		EvictionRatio          float64       `mapstructure:"evictionratio"`
		KeysLimit              int           `mapstructure:"keyslimit"`
		AOFFile                string        `mapstructure:"aoffile"`
		PersistenceEnabled     bool          `mapstructure:"persistenceenabled"`
		WriteAOFOnCleanup      bool          `mapstructure:"writeaofoncleanup"`
		LogLevel               string        `mapstructure:"loglevel"`
		PrettyPrintLogs        bool          `mapstructure:"prettyprintlogs"`
	} `mapstructure:"server"`
	Auth struct {
		UserName string `mapstructure:"username"`
		Password string `mapstructure:"password"`
	} `mapstructure:"auth"`
	Network struct {
		IOBufferLength    int `mapstructure:"iobufferlength"`
		IOBufferLengthMAX int `mapstructure:"iobufferlengthmax"`
	} `mapstructure:"network"`
}

// Default configurations for internal use
var defaultConfig = Config{
	Server: struct {
		Addr                   string        `mapstructure:"addr"`
		Port                   int           `mapstructure:"port"`
		KeepAlive              int32         `mapstructure:"keepalive"`
		Timeout                int32         `mapstructure:"timeout"`
		MaxConn                int32         `mapstructure:"max-conn"`
		ShardCronFrequency     time.Duration `mapstructure:"shardcronfrequency"`
		MultiplexerPollTimeout time.Duration `mapstructure:"servermultiplexerpolltimeout"`
		MaxClients             int           `mapstructure:"maxclients"`
		MaxMemory              int64         `mapstructure:"maxmemory"`
		EvictionPolicy         string        `mapstructure:"evictionpolicy"`
		EvictionRatio          float64       `mapstructure:"evictionratio"`
		KeysLimit              int           `mapstructure:"keyslimit"`
		AOFFile                string        `mapstructure:"aoffile"`
		PersistenceEnabled     bool          `mapstructure:"persistenceenabled"`
		WriteAOFOnCleanup      bool          `mapstructure:"writeaofoncleanup"`
		LogLevel               string        `mapstructure:"loglevel"`

Review comment (suggestion):
I think rather than using `PrettyPrintLogs` we should use env based log ( i.e dev/prod ) allow pretty logs in dev

Code after:
	CustomConfigFilePath = utils.EmptyStr
	ConfigFileLocation   = utils.EmptyStr

	InitConfigCmd = false
)

type Config struct {
	Server struct {
		Addr                   string        `mapstructure:"addr"`
		Port                   int           `mapstructure:"port"`
		KeepAlive              int32         `mapstructure:"keepalive"`
		Timeout                int32         `mapstructure:"timeout"`
		MaxConn                int32         `mapstructure:"max-conn"`
		ShardCronFrequency     time.Duration `mapstructure:"shardcronfrequency"`
		MultiplexerPollTimeout time.Duration `mapstructure:"servermultiplexerpolltimeout"`
		MaxClients             int           `mapstructure:"maxclients"`
		MaxMemory              int64         `mapstructure:"maxmemory"`
		EvictionPolicy         string        `mapstructure:"evictionpolicy"`
		EvictionRatio          float64       `mapstructure:"evictionratio"`
		KeysLimit              int           `mapstructure:"keyslimit"`
		AOFFile                string        `mapstructure:"aoffile"`
		PersistenceEnabled     bool          `mapstructure:"persistenceenabled"`
		WriteAOFOnCleanup      bool          `mapstructure:"writeaofoncleanup"`
		LFULogFactor           int           `mapstructure:"lfulogfactor"`
		LogLevel               string        `mapstructure:"loglevel"`
		PrettyPrintLogs        bool          `mapstructure:"prettyprintlogs"`
	} `mapstructure:"server"`
	Auth struct {
		UserName string `mapstructure:"username"`
		Password string `mapstructure:"password"`
	} `mapstructure:"auth"`
	Network struct {
		IOBufferLength    int `mapstructure:"iobufferlength"`
		IOBufferLengthMAX int `mapstructure:"iobufferlengthmax"`
	} `mapstructure:"network"`
}

// Default configurations for internal use
var baseConfig = Config{
	Server: struct {
		Addr                   string        `mapstructure:"addr"`
		Port                   int           `mapstructure:"port"`
		KeepAlive              int32         `mapstructure:"keepalive"`
		Timeout                int32         `mapstructure:"timeout"`
		MaxConn                int32         `mapstructure:"max-conn"`
		ShardCronFrequency     time.Duration `mapstructure:"shardcronfrequency"`
		MultiplexerPollTimeout time.Duration `mapstructure:"servermultiplexerpolltimeout"`
		MaxClients             int           `mapstructure:"maxclients"`
		MaxMemory              int64         `mapstructure:"maxmemory"`
		EvictionPolicy         string        `mapstructure:"evictionpolicy"`
		EvictionRatio          float64       `mapstructure:"evictionratio"`