Documentation
¶
Index ¶
- Constants
- Variables
- func AutoReload(serverInfo *ServerInfo, config *nginx.Config, signal chan int)
- func Bak(serverInfo *ServerInfo, config *nginx.Config, signal chan int)
- func Log(level logger.LogLevel, message string)
- func PathExists(path string) (bool, error)
- func Restart() error
- func Run()
- func Start() (err error)
- func Status() (int, error)
- func Stop() error
- type Config
- type DBConfig
- type JWTClaims
- type LogConfig
- type ServerInfo
- type WebServerInfo
- type WebServerType
Constants ¶
View Source
const ( // 认证接口错误返回 ErrorReasonServerBusy = "服务器繁忙" ErrorReasonRelogin = "请重新登陆" ErrorReasonWrongPassword = "用户或密码错误" )
View Source
const ( // 日志级别 CRITICAL = logger.CriticalLevel ERROR = logger.ErrorLevel WARN = logger.WarningLevel NOTICE = logger.NoticeLevel INFO = logger.InfoLevel DEBUG = logger.DebugLevel // 版本号 VERSION = "v1.0.0-alpha.5" // Web服务类型 NGINX WebServerType = "nginx" HTTPD WebServerType = "httpd" )
Variables ¶
View Source
var ( Signal = flag.String("s", "", "send `signal` to a master process: stop, restart, status") // bifrost配置 BifrostConf *Config // 日志文件 Logf *os.File Stdoutf *os.File )
View Source
var (
ExpireTime = 3600 // token有效期
)
Functions ¶
func AutoReload ¶
func AutoReload(serverInfo *ServerInfo, config *nginx.Config, signal chan int)
AutoReload, web服务器配置文件自动热加载函数 参数:
serverInfo: web服务器配置文件信息对象指针 config: nginx配置对象指针 c: 整型管道,用于停止备份
func Bak ¶
func Bak(serverInfo *ServerInfo, config *nginx.Config, signal chan int)
Bak, nginx配置文件备份函数 参数:
serverInfo: web服务器配置文件信息对象指针 config: nginx配置对象指针 c: 整型管道,用于停止备份
Types ¶
type Config ¶
type Config struct {
WebServerInfo WebServerInfo `yaml:"WebServerInfo"`
DBConfig `yaml:"DBConfig"`
LogConfig `yaml:"logConfig"`
}
Config, bifrost配置文件结构体,定义bifrost配置信息
type DBConfig ¶
type DBConfig struct {
DBName string `yaml:"DBName"`
Host string `yaml:"host"`
Port int `yaml:"port"`
Protocol string `yaml:"protocol"`
User string `yaml:"user"`
Password string `yaml:"password"`
}
DBConfig, mysql数据库信息结构体,用于读写bifrost信息
type JWTClaims ¶
type JWTClaims struct {
jwt.StandardClaims
UserID int `json:"user_id"`
Password string `json:"password"`
Username string `json:"username"`
FullName string `json:"full_name"`
Permissions []string `json:"permissions"`
}
JWTClaims, jwt断言对象,定义认证接口校验的用户信息
type ServerInfo ¶
type ServerInfo struct {
Name string `yaml:"name"`
ServerType WebServerType `yaml:"serverType"`
BaseURI string `yaml:"baseURI"`
BackupCycle int `yaml:"backupCycle"`
BackupSaveTime int `yaml:"backupSaveTime"`
BackupDir string `yaml:"backupDir,omitempty"`
ConfPath string `yaml:"confPath"`
VerifyExecPath string `yaml:"verifyExecPath"`
// contains filtered or unexported fields
}
ServerInfo, nginx配置文件信息结构体,定义配置文件路径、nginx可执行文件路径和bifrost为其提供接口的路由及侦听端口
type WebServerInfo ¶
type WebServerInfo struct {
ListenPort int `yaml:"listenPort"`
Servers []ServerInfo `yaml:"servers"`
}
WebServerInfo, bifrost配置文件对象中web服务器信息结构体,定义管控的web服务器配置文件相关信息
Click to show internal directories.
Click to hide internal directories.