config

package
v0.0.0-...-58fd0e2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKoanf

func NewKoanf() (*koanf.Koanf, error)

func NewTestConfig

func NewTestConfig() (*koanf.Koanf, error)

Types

type AppConfig

type AppConfig struct {
	App struct {
		Port int    `koanf:"port,omitempty"`
		Mode string `koanf:"mode,omitempty"`
	} `koanf:"app,omitempty"`
	Log struct {
		Level    string `koanf:"level,omitempty"`
		Format   string `koanf:"format,omitempty"`
		LinkName string `koanf:"linkName,omitempty"`
		Path     string `koanf:"path,omitempty"`
	} `koanf:"log,omitempty"`
	Db struct {
		Dialect     string `koanf:"dialect,omitempty"`
		Host        string `koanf:"host,omitempty"`
		Port        int    `koanf:"port,omitempty"`
		Username    string `koanf:"username,omitempty"`
		Password    string `koanf:"password,omitempty"`
		Database    string `koanf:"database,omitempty"`
		TablePrefix string `koanf:"tablePrefix,omitempty"`
		DevDsn      string `koanf:"devDsn,omitempty"`
	} `koanf:"db,omitempty"`
	Jwt struct {
		Secret string `koanf:"secret,omitempty"`
	} `koanf:"jwt,omitempty"`
	Cors struct {
		AllowOrigin      []string `koanf:"allowOrigin,omitempty"`
		AllowCredentials bool     `koanf:"allowCredentials,omitempty"`
		MaxAge           string   `koanf:"maxAge,omitempty"`
	} `koanf:"cors,omitempty"`
	Redis struct {
		Addr     string `koanf:"addr,omitempty"`
		Password string `koanf:"password,omitempty"`
		Db       int    `koanf:"db,omitempty"`
	} `koanf:"redis,omitempty"`
	Mail struct {
		From           string        `koanf:"from,omitempty"`
		Host           string        `koanf:"host,omitempty"`
		Port           int           `koanf:"port,omitempty"`
		Username       string        `koanf:"username,omitempty"`
		Password       string        `koanf:"password,omitempty"`
		KeepAlive      bool          `koanf:"keepAlive,omitempty"`
		ConnectTimeout time.Duration `koanf:"connectTimeout,omitempty"`
		SendTimeout    time.Duration `koanf:"sendTimeout,omitempty"`
	} `koanf:"mail,omitempty"`
}

func NewConfig

func NewConfig(k *koanf.Koanf) (*AppConfig, error)

Jump to

Keyboard shortcuts

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