config

package
v0.0.0-...-49cc056 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDB

func InitDB(conf ...*DbConf) *xorm.Engine

func IsDebug

func IsDebug() bool

func Orm

func Orm() *xorm.Engine

func RuntimePath

func RuntimePath(path ...string) string

func SiteConfig

func SiteConfig() (map[string]string, error)

Types

type Config

type Config struct {
	Debug   bool     `yaml:"debug"`
	Port    int64    `yaml:"port"`
	View    viewConf `yaml:"view"`
	Session SessConf `yaml:"session"`

	LogPath      string `yaml:"log_path"`
	RuntimePath  string `yaml:"runtime_path"`
	PluginPath   string `yaml:"plugin_path"`
	PluginEnable bool   `yaml:"plugin_enable"`
	CacheDb      string `yaml:"cache_db"`

	Charset  string `yaml:"charset"`
	JwtKey   string `yaml:"jwtkey"`
	HashKey  string `yaml:"hashkey"`
	BlockKey string `yaml:"blockkey"`

	Upload struct {
		MaxBodySize int64  `yaml:"max_bodysize"`
		Engine      string `yaml:"engine"`
		BasePath    string `yaml:"base_path"`
	} `yaml:"upload"`

	Statics []struct {
		Route string `yaml:"route"`
		Path  string `yaml:"path"`
	} `yaml:"statics"`
}

func App

func App() *Config

func (*Config) StaticPrefixArr

func (c *Config) StaticPrefixArr() []string

type Db

type Db struct {
	DbDriver string `yaml:"driver"`
	Dsn      string `yaml:"dsn"`
	DbPrefix string `yaml:"prefix"`
	Conf     dbInfo `yaml:"-" json:"-"`
}

type DbConf

type DbConf struct {
	*xorm.Engine `yaml:"-"`
	sync.Once    `yaml:"-"`
	Db           Db        `yaml:"db"`
	Orm          orm       `yaml:"orm"`
	Redis        redisConf `yaml:"redis"`
}

func DB

func DB() *DbConf

func (*DbConf) BuildYaml

func (t *DbConf) BuildYaml() error

func (*DbConf) Initialized

func (t *DbConf) Initialized() bool

type Html

type Html struct {
	Path   string `yaml:"path"`
	Suffix string `yaml:"suffix"`
}

type SessConf

type SessConf struct {
	Name    string        `yaml:"name"`
	Expires time.Duration `yaml:"expires"`
}

Jump to

Keyboard shortcuts

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