config

package
v0.0.0-...-c79a6bb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvDebug      = "debug"
	EnvStaging    = "staging"
	EnvProduction = "production"

	FrameworkGin   = "gin"
	FrameworkEcho  = "echo"
	FrameworkFiber = "fiber"
)
View Source
const (
	ConsoleEncoding = "console"
	JsonEncoding    = "json"
)
View Source
const (
	EncoderLevelLowercase      = "lowercase"
	EncoderLevelLowercaseColor = "lowercase_color"
	EncoderLevelCapital        = "capital"
	EncoderLevelCapitalColor   = "capital_color"
	EncoderTimeEpoch           = "epoch"
	EncoderTimeEpochMillis     = "epoch_millis"
	EncoderTimeEpochNanos      = "epoch_nanos"
	EncoderTimeISO8601         = "iso8601"
	EncoderTimeRFC3339         = "rfc3339"
	EncoderTimeRFC3339Nano     = "rfc3339_nano"
)

Variables

View Source
var (
	ListOfLevel = []interface{}{
		zapcore.DebugLevel.String(),
		zapcore.InfoLevel.String(),
		zapcore.WarnLevel.String(),
		zapcore.ErrorLevel.String(),
		zapcore.DPanicLevel.String(),
		zapcore.PanicLevel.String(),
		zapcore.FatalLevel.String(),
	}
	ListOfEncoding = []interface{}{
		ConsoleEncoding,
		JsonEncoding,
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Env          string
	Framework    string
	DatabaseType string
	Logger       *Logger
}

func Load

func Load(configPath, configEnvPrefix *string) (*Config, error)

func (Config) Validate

func (c Config) Validate() error

type Logger

type Logger struct {
	Level            string                 `json:"level"`
	Encoding         string                 `json:"encoding,omitempty"`
	InitialFields    map[string]interface{} `json:"initial_fields,omitempty"`
	OutputPaths      []string               `json:"output_paths,omitempty"`
	ErrorOutputPaths []string               `json:"error_output_paths,omitempty"`
	Encoder          *LoggerEncoder         `json:"encoder,omitempty"`
	RequestLogOn     bool                   `json:"request_log_on"`
}

func (Logger) Validate

func (l Logger) Validate() error

type LoggerEncoder

type LoggerEncoder struct {
	EncodeLevel string `json:"encode_level"`
	EncodeTime  string `json:"encode_time"`
}

func (LoggerEncoder) Validate

func (l LoggerEncoder) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL