config

package
v0.0.1-rc01 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDemoEnv

func IsDemoEnv() bool

IsDemoEnv 是否是demo环境

Types

type AppConfig

type AppConfig struct {
	Server Server                  `json:"server"`
	Auth   AuthConfig              `json:"auth"`
	DB     map[string]*DbConfig    `json:"db"`
	Redis  map[string]*RedisConfig `json:"redis"`
}

func GetConfig

func GetConfig() AppConfig

type AuthConfig

type AuthConfig struct {
	Version string `json:"version"`
	Secret  string `json:"secret"`
}

type CorsConfig

type CorsConfig struct {
	AllowOrigins []string `json:"allow-origins"`
}

CorsConfig 跨域配置

type DbConfig

type DbConfig struct {
	Type    string `json:"type"`
	Dsn     string `json:"dsn"`
	MaxIdle int    `json:"max-idle"`
	MaxConn int    `json:"max-conn"`
	ShowSQL bool   `json:"show-sql"`
}

type HTTPServerConfig

type HTTPServerConfig struct {
	ServerName string     `json:"server-name"`
	Listen     string     `json:"listen"`
	Cors       CorsConfig `json:"cors"`
}

type RedisConfig

type RedisConfig struct {
	Addr     string `json:"addr"`
	Password string `json:"password"`
	DB       int    `json:"db"`
}

type Server

type Server struct {
	HTTP HTTPServerConfig
}

Jump to

Keyboard shortcuts

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