Documentation ¶
Overview ¶
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Wenhui Shen <www.webx.top>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func CmdIsRunning(cmd *exec.Cmd) bool
- func ConnectDB() error
- func ConnectMongoDB(c *Config) error
- func ConnectMySQL(c *Config) error
- func CreaterMySQL(err error, c *Config) error
- func ExecMySQL(sqlStr string) error
- func InitLog()
- func InitSessionOptions()
- func IsInstalled() bool
- func MustOK(err error)
- func ParseConfig() error
- func ParseTimeDuration(timeout string) time.Duration
- func SetVersion(version string)
- func Version() string
- type CLIConfig
- func (c *CLIConfig) CaddyRestart(writer ...io.Writer) error
- func (c *CLIConfig) CaddyStart(writer ...io.Writer) (err error)
- func (c *CLIConfig) CaddyStop() error
- func (c *CLIConfig) CaddyStopHistory() (err error)
- func (c *CLIConfig) CmdStop(typeName string) error
- func (c *CLIConfig) FTPRestart(writer ...io.Writer) error
- func (c *CLIConfig) FTPStart(writer ...io.Writer) (err error)
- func (c *CLIConfig) FTPStop() error
- func (c *CLIConfig) FTPStopHistory() (err error)
- func (c *CLIConfig) InitFlag()
- func (c *CLIConfig) IsRunning(ct string) bool
- func (c *CLIConfig) OnlyRunServer() bool
- func (c *CLIConfig) Reload() error
- func (c *CLIConfig) RunStartup()
- func (c *CLIConfig) SetLogWriter(cmdType string, writer ...io.Writer) error
- type Config
Constants ¶
This section is empty.
Variables ¶
var ( Installed sql.NullBool DefaultConfig = &Config{} DefaultCLIConfig = &CLIConfig{cmds: map[string]*exec.Cmd{}} ErrUnknowDatabaseType = errors.New(`unkown database type`) )
var ( SessionOptions *echo.SessionOptions CookieOptions *cookie.CookieOptions )
var ( DBConnecters = map[string]func(*Config) error{ `mysql`: ConnectMySQL, `mongo`: ConnectMongoDB, } DBInstallers = map[string]func(string) error{ `mysql`: ExecMySQL, } DBCreaters = map[string]func(error, *Config) error{ `mysql`: CreaterMySQL, } DBEngines = echo.NewKVData().Add(`mysql`, `MySQL`) )
var ErrCmdNotRunning = errors.New(`command is not running`)
Functions ¶
func CmdIsRunning ¶
func ConnectMongoDB ¶ added in v1.1.0
func ConnectMySQL ¶ added in v1.1.0
func CreaterMySQL ¶ added in v1.1.0
func InitSessionOptions ¶
func InitSessionOptions()
func IsInstalled ¶
func IsInstalled() bool
func ParseConfig ¶
func ParseConfig() error
func ParseTimeDuration ¶
func SetVersion ¶
func SetVersion(version string)
Types ¶
type CLIConfig ¶
type CLIConfig struct { Port int Conf string Type string //启动类型: webserver/ftpserver/manager Startup string //manager启动时同时启动的服务,可选的有webserver/ftpserver,如有多个需用半角逗号“,”隔开 // contains filtered or unexported fields }
func (*CLIConfig) CaddyStopHistory ¶
func (*CLIConfig) FTPStopHistory ¶
func (*CLIConfig) OnlyRunServer ¶
type Config ¶
type Config struct { DB struct { Type string `json:"type"` User string `json:"user"` Password string `json:"password"` Host string `json:"host"` Database string `json:"database"` Prefix string `json:"prefix"` Options map[string]string `json:"options"` Debug bool `json:"debug"` } `json:"db"` Log struct { Debug bool `json:"debug"` Colorable bool `json:"colorable"` // for console SaveFile string `json:"saveFile"` // for file FileMaxBytes int64 `json:"fileMaxBytes"` // for file Targets string `json:"targets"` } `json:"log"` Sys struct { VhostsfileDir string `json:"vhostsfileDir"` AllowIP []string `json:"allowIP"` SSLHosts []string `json:"sslHosts"` SSLCacheDir string `json:"sslCacheDir"` SSLKeyFile string `json:"sslKeyFile"` SSLCertFile string `json:"sslCertFile"` Debug bool `json:"debug"` EditableFileExtensions map[string]string `json:"editableFileExtensions"` EditableFileMaxSize string `json:"editableFileMaxSize"` EditableFileMaxBytes int64 `json:"editableFileMaxBytes"` ErrorPages map[int]string `json:"errorPages"` CmdTimeout string `json:"cmdTimeout"` CmdTimeoutDuration time.Duration `json:"-"` } `json:"sys"` Email struct { *mail.SMTPConfig Timeout int64 //超时时间(秒),采用默认引擎发信时,此项无效 Engine string //值为email时采用github.com/jordan-wright/email包发送,否则采用默认的github.com/admpub/mail发送 From string //发信人Email地址 QueueSize int //允许同一时间发信的数量 } `json:"email"` Cron struct { PoolSize int `json:"poolSize"` Template string `json:"template"` //发信模板 } `json:"cron"` Cookie struct { Domain string `json:"domain"` MaxAge int `json:"maxAge"` Path string `json:"path"` HttpOnly bool `json:"httpOnly"` HashKey string `json:"hashKey"` BlockKey string `json:"blockKey"` } `json:"cookie"` Caddy caddy.Config `json:"caddy"` FTP ftp.Config `json:"ftp"` Language language.Config `json:"language"` Download struct { SavePath string `json:"savePath"` } `json:"download"` }