config

package
v0.0.0-...-b942761 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	C = new(Config)
)

Functions

func MustLoad

func MustLoad(path string)

Load config file (toml/json/yaml)

func PrintWithJSON

func PrintWithJSON()

Types

type Config

type Config struct {
	ServerConfig ServerConfig `json:"server" mapstructure:"server"`
	Redis        Redis        `json:"redis" mapstructure:"redis"`
	Gorm         Gorm         `json:"gorm" mapstructure:"gorm"`
	PrintConfig  bool         `json:"print_config" mapstructure:"print_config"`
}

type Gorm

type Gorm struct {
	Debug             bool   `json:"debug" mapstructure:"debug"`
	DBType            string `json:"db_type" mapstructure:"db_type"`
	DbName            string `json:"db_name" mapstructure:"db_name"`
	MaxLifetime       int    `json:"max_lifetime" mapstructure:"max_lifetime"`
	MaxOpenConns      int    `json:"max_open_conns" mapstructure:"max_open_conns"`
	MaxIdleConns      int    `json:"max_idle_conns" mapstructure:"max_idle_conns"`
	TablePrefix       string `json:"table_prefix" mapstructure:"table_prefix"`
	EnableAutoMigrate bool   `json:"enable_auto_migrate" mapstructure:"enable_auto_migrate"`
	Dsn               string `json:"dsn" mapstructure:"dsn"`
}

type Redis

type Redis struct {
	Addr      string `json:"addr" mapstructure:"addr"`
	Password  string `json:"password" mapstructure:"password"`
	DB        int    `json:"db" mapstructure:"db"`
	KeyPrefix string `json:"key_prefix" mapstructure:"key_prefix"`
}

type ServerConfig

type ServerConfig struct {
	Host         string   `json:"host" mapstructure:"host"`
	GrpcProtocol string   `json:"grpc_protocol" mapstructure:"grpc_protocol"`
	GrpcPort     string   `json:"grpc_port" mapstructure:"grpc_port"`
	HttpPort     string   `json:"http_port" mapstructure:"http_port"`
	Cert         string   `json:"cert" mapstructure:"cert"`
	Key          string   `json:"key" mapstructure:"key"`
	CAName       string   `json:"ca_name" mapstructure:"ca_name"`
	AuthKey      string   `json:"auth_key" mapstructure:"auth_key"`
	Tokens       []string `json:"tokens" mapstructure:"tokens"`
}

Jump to

Keyboard shortcuts

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