config

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "v0.15.0"

Variables

View Source
var ConfigPath string = "./config.yml"

Functions

func Set

func Set(c *Config) error

Set sets c as the global config.

Types

type Config

type Config struct {
	// 路径
	Path Path `yaml:"path"`
	// Github 主页
	Github Github `yaml:"github"`
	// 服务器参数
	Server Server `yaml:"server"`
	// 权限组
	Permission Permission `yaml:"permission"`
	// 额外参数
	Extra map[string]string `yaml:"extra"`
}

webhook 配置

var Global *Config

func (*Config) BeforeDefault

func (c *Config) BeforeDefault() error

func (*Config) Export

func (c *Config) Export() error

type Github

type Github struct {
	Folder     string `yaml:"-"`
	Username   string `yaml:"username"   default:"Drelf2018"`
	Repository string `yaml:"repository" default:"gin.nana7mi.link"`
	Branche    string `yaml:"branche"    default:"gh-pages"`
	// contains filtered or unexported fields
}

func (*Github) AfterConfigGithub

func (g *Github) AfterConfigGithub(c *Config)

func (*Github) Api

func (g *Github) Api() string

func (*Github) Clone

func (g *Github) Clone() error

克隆到文件夹

func (*Github) Done

func (g *Github) Done() int

func (*Github) ForcePull

func (g *Github) ForcePull() error

func (*Github) Git

func (g *Github) Git() string

func (*Github) ReferenceName

func (g *Github) ReferenceName() plumbing.ReferenceName

func (*Github) RemoteName

func (g *Github) RemoteName() plumbing.ReferenceName

func (Github) String

func (g Github) String() string

func (*Github) SyncRepository

func (g *Github) SyncRepository() error

type Path

type Path struct {
	Root     string `yaml:"root"   default:"resource"`
	Log      string `yaml:"log"    default:".log"     join:"Root"`
	Views    string `yaml:"views"  default:"views"    join:"Root"`
	UserDB   string `yaml:"userDB" default:"users.db" join:"Root"`
	Public   string `yaml:"public" default:"public"   join:"Root"`
	PostDB   string `yaml:"postDB" default:"posts.db" join:"Public"`
	FullPath *Path  `yaml:"-" initial:"-"`
}

func (*Path) AfterDefault

func (p *Path) AfterDefault() (err error)

type Permission

type Permission struct {
	// 所有者
	Owner string `yaml:"owner"`
	// 管理员
	Administrators []string `yaml:"administrators"`
	// 信任者
	Trustors []string `yaml:"trustors"`
}

type Server

type Server struct {
	// 模式
	Mode string `default:"release"`
	// 主机
	Host string `yaml:"host"`
	// 端口 0~65535
	Port uint16 `yaml:"port" default:"9000"`
}

func (Server) Addr

func (s Server) Addr() string

Jump to

Keyboard shortcuts

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