config

package
v0.0.0-...-1100b98 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitApplicationCfg

func InitApplicationCfg()

func InitConfig

func InitConfig()

func InitPlatformCfg

func InitPlatformCfg()

func JwtSecretKey

func JwtSecretKey() string

func Mkdirs

func Mkdirs()

Types

type ApplicationCfg

type ApplicationCfg struct {
	Gin struct {
		Host string `yaml:"host" json:"host" mapstructure:"host"`
		Port int    `yaml:"port" json:"port" mapstructure:"port"`
		CORS struct {
			AllowOrigins []string `yaml:"allow_origins" json:"allow_origins" mapstructure:"allow_origins"`
			AllowMethods []string `yaml:"allow_methods" json:"allow_methods" mapstructure:"allow_methods"`
		} `yaml:"cors" json:"cors" mapstructure:"cors"`
		Jwt struct {
			Expiration int `yaml:"expiration" json:"expiration" mapstructure:"expiration"`
		} `yaml:"jwt" json:"jwt" mapstructure:"jwt"`
		Cache struct {
			Provider string `yaml:"provider" json:"provider" mapstructure:"provider"`
			Redis    struct {
				Host     string `yaml:"host" json:"host" mapstructure:"host"`
				Port     int    `yaml:"port" json:"port" mapstructure:"port"`
				Password string `yaml:"password" json:"password" mapstructure:"password"`
				DB       int    `yaml:"db" json:"db" mapstructure:"db"`
			} `yaml:"redis" json:"redis" mapstructure:"redis"`
		} `yaml:"cache" json:"cache" mapstructure:"cache"`
	} `yaml:"gin" json:"gin" mapstructure:"gin"`
	Email struct {
		Address  string `yaml:"address" json:"address" mapstructure:"address"`
		Password string `yaml:"password" json:"password" mapstructure:"password"`
		SMTP     struct {
			Host string `yaml:"host" json:"host" mapstructure:"host"`
			Port int    `yaml:"port" json:"port" mapstructure:"port"`
		} `yaml:"smtp" json:"smtp" mapstructure:"smtp"`
	} `yaml:"email" json:"email" mapstructure:"email"`
	Captcha struct {
		Enabled   bool   `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
		Provider  string `yaml:"provider" json:"provider" mapstructure:"provider"`
		ReCaptcha struct {
			URL       string  `yaml:"url" json:"url" mapstructure:"url"`
			SiteKey   string  `yaml:"site_key" json:"site_key" mapstructure:"site_key"`
			SecretKey string  `yaml:"secret_key" json:"secret_key" mapstructure:"secret_key"`
			Threshold float64 `yaml:"threshold" json:"threshold" mapstructure:"threshold"`
		} `yaml:"recaptcha" json:"recaptcha" mapstructure:"recaptcha"`
		Turnstile struct {
			URL       string `yaml:"url" json:"url" mapstructure:"url"`
			SiteKey   string `yaml:"site_key" json:"site_key" mapstructure:"site_key"`
			SecretKey string `yaml:"secret_key" json:"secret_key" mapstructure:"secret_key"`
		} `yaml:"turnstile" json:"turnstile" mapstructure:"turnstile"`
	} `yaml:"captcha" json:"captcha" mapstructure:"captcha"`
	DB struct {
		Provider string `yaml:"provider" json:"provider" mapstructure:"provider"`
		Postgres struct {
			Host     string `yaml:"host" json:"host" mapstructure:"host"`
			Port     int    `yaml:"port" json:"port" mapstructure:"port"`
			Username string `yaml:"username" json:"username" mapstructure:"username"`
			Password string `yaml:"password" json:"password" mapstructure:"password"`
			Dbname   string `yaml:"dbname" json:"dbname" mapstructure:"dbname"`
			Sslmode  string `yaml:"sslmode" json:"sslmode" mapstructure:"sslmode"`
		} `yaml:"postgres" json:"postgres" mapstructure:"postgres"`
		SQLite struct {
			Path string `yaml:"path" json:"path" mapstructure:"path"`
		} `yaml:"sqlite" json:"sqlite" mapstructure:"sqlite"`
		MySQL struct {
			Host     string `yaml:"host" json:"host" mapstructure:"host"`
			Port     int    `yaml:"port" json:"port" mapstructure:"port"`
			Username string `yaml:"username" json:"username" mapstructure:"username"`
			Password string `yaml:"password" json:"password" mapstructure:"password"`
			Dbname   string `yaml:"dbname" json:"dbname" mapstructure:"dbname"`
		} `yaml:"mysql" json:"mysql" mapstructure:"mysql"`
	} `yaml:"db" json:"db" mapstructure:"db"`
	Container struct {
		Provider string `yaml:"provider" json:"provider" mapstructure:"provider"`
		Entry    string `yaml:"entry" json:"entry" mapstructure:"entry"`
		Docker   struct {
			URI string `yaml:"uri" json:"uri" mapstructure:"uri"`
		} `yaml:"docker" json:"docker" mapstructure:"docker"`
		K8s struct {
			NameSpace string `yaml:"namespace" json:"namespace" mapstructure:"namespace"`
			Config    struct {
				Path string `yaml:"path" json:"path" mapstructure:"path"`
			} `yaml:"config" json:"config" mapstructure:"config"`
		} `yaml:"k8s" json:"k8s" mapstructure:"k8s"`
		Proxy struct {
			Enabled        bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
			TrafficCapture struct {
				Enabled bool   `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
				Path    string `yaml:"path" json:"path" mapstructure:"path"`
			} `yaml:"traffic_capture" json:"traffic_capture" mapstructure:"traffic_capture"`
		} `yaml:"proxy" json:"proxy" mapstructure:"proxy"`
	} `yaml:"container" json:"container" mapstructure:"container"`
}

func AppCfg

func AppCfg() *ApplicationCfg

func (*ApplicationCfg) Save

func (a *ApplicationCfg) Save() (err error)

type PlatformCfg

type PlatformCfg struct {
	Site struct {
		Title       string `yaml:"title" json:"title" mapstructure:"title"`
		Description string `yaml:"description" json:"description" mapstructure:"description"`
		Color       string `yaml:"color" json:"color" mapstructure:"color"`
	} `yaml:"site" json:"site" mapstructure:"site"`
	Container struct {
		ParallelLimit int `yaml:"parallel_limit" json:"parallel_limit" mapstructure:"parallel_limit"`
		RequestLimit  int `yaml:"request_limit" json:"request_limit" mapstructure:"request_limit"`
	} `yaml:"container" json:"container" mapstructure:"container"`
	User struct {
		Register struct {
			Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
			Captcha struct {
				Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
			} `yaml:"captcha" json:"captcha" mapstructure:"captcha"`
			Email struct {
				Domains []string `yaml:"domains" json:"domains" mapstructure:"domains"`
				Enabled bool     `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
			}
		} `yaml:"register" json:"register" mapstructure:"register"`
	} `yaml:"user" json:"user" mapstructure:"user"`
}

func PltCfg

func PltCfg() *PlatformCfg

func (*PlatformCfg) Save

func (p *PlatformCfg) Save() (err error)

Jump to

Keyboard shortcuts

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