configs

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Set added in v0.7.0

func Set(c *Config)

func SetNil

func SetNil[C any, T utils.CanNil[C]](a *T, b T)

设置引用类型对象默认值

func SetZero

func SetZero[T comparable](a *T, b ...T)

设置值类型对象默认值

Types

type Config

type Config struct {
	// 引擎
	*gin.Engine `yaml:"-"`
	// 测试
	Debug bool `yaml:"debug"`
	// 端口 0~65535
	Port uint16 `yaml:"port"`
	// 动态
	Oid string `yaml:"oid"`
	// 资源文件夹路径
	Path Path `yaml:"path"`
	// Github 主页
	Github Github `yaml:"github"`
	// 管理员
	Administrators []string `yaml:"administrators"`
}

webhook 配置

func Get added in v0.7.0

func Get() *Config

func (*Config) Init

func (r *Config) Init()

自动填充

func (*Config) UpdateIndex

func (r *Config) UpdateIndex() (err error)

更新主页

type Github

type Github struct {
	Username   string `yaml:"username"`
	Repository string `yaml:"repository"`
	Branche    string `yaml:"branche"`

	Sha    []byte `yaml:"-"`
	Commit struct {
		Sha string `json:"sha"`
	} `json:"commit" yaml:"-"`
}

func (*Github) API added in v0.7.0

func (g *Github) API() string

func (*Github) Clone

func (g *Github) Clone(folder string) error

克隆到文件夹

func (*Github) GIT added in v0.7.0

func (g *Github) GIT() string

func (*Github) GetLatestCommit

func (g *Github) GetLatestCommit() error

获取最新提交

func (*Github) Init

func (g *Github) Init()

type Path

type Path struct {
	Root   string `yaml:"root"`
	Views  string `yaml:"views"`
	Public string `yaml:"public"`
	Posts  string `yaml:"posts"`
	Users  string `yaml:"users"`
	Log    string `yaml:"log"`
	Full   struct {
		Views  string
		Public string
		Posts  string
		Users  string
		Log    string

		Index   string
		Version string
	} `yaml:"-"`
}

资源文件夹路径

func (*Path) Init

func (p *Path) Init()

Jump to

Keyboard shortcuts

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