config

package
v0.0.0-...-66fcd57 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Gin      Gin      `mapstructure:"gin" json:"gin" yaml:"gin"`
	Log      Log      `mapstructure:"log" json:"log" yaml:"log"`
	DataBase DataBase `mapstructure:"database" json:"database" yaml:"database"`
	JWT      JWT      `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
	Role     Role     `mapstructure:"role" json:"role" yaml:"role"`
}

func InitConfig

func InitConfig() (*Config, error)

type DataBase

type DataBase struct {
	Driver   string          `mapstructure:"driver" json:"driver" yaml:"driver"`
	LogLevel logger.LogLevel `mapstructure:"log_level" json:"log_level" yaml:"log_level"`
	MySql    struct {
		Source string `mapstructure:"source" json:"source" yaml:"source"`
	} `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
	Redis struct {
		UserName     string        `mapstructure:"user_name" json:"user_name" yaml:"user_name"`
		Password     string        `mapstructure:"password" json:"password" yaml:"password"`
		Addr         string        `mapstructure:"addr" json:"addr" yaml:"addr"`
		DB           int           `mapstructure:"db" json:"db" yaml:"db"`
		ReadTimeout  time.Duration `mapstructure:"read_timeout" json:"read_timeout" yaml:"read_timeout"`
		WriteTimeout time.Duration `mapstructure:"write_timeout" json:"write_timeout" yaml:"write_timeout"`
	} `yaml:"redis"`
}

type Gin

type Gin struct {
	Host  string `mapstructure:"host" json:"host" yaml:"host"`
	Model string `mapstructure:"model" json:"model" yaml:"model"`
}

type JWT

type JWT struct {
	SecretKey         string `mapstructure:"secret_key" json:"secret_key" yaml:"secret_key"`
	ExpirationSeconds int64  `mapstructure:"expiration_seconds" json:"expiration_seconds" yaml:"expiration_seconds"`
	Issuer            string `mapstructure:"issuer" json:"issuer" yaml:"issuer"`
}

type Log

type Log struct {
	Level     zapcore.Level `mapstructure:"level" json:"level" yaml:"level"`
	LogPath   string        `mapstructure:"log_path" json:"log_path" yaml:"log_path"`
	SplitSize int           `mapstructure:"split_size" json:"split_size" yaml:"split_size"`
}

type Role

type Role struct {
	DefaultRole      string `mapstructure:"default_role" json:"default_role" yaml:"default_role"`
	DefaultAdminRole string `mapstructure:"default_admin_role" json:"default_admin_role" yaml:"default_admin_role"`
}

Jump to

Keyboard shortcuts

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