mirror of https://github.com/Xhofe/alist
🎇 support https
parent
bd91acc5d0
commit
944941db10
7
alist.go
7
alist.go
|
@ -54,7 +54,12 @@ func main() {
|
|||
server.InitApiRouter(r)
|
||||
base := fmt.Sprintf("%s:%d", conf.Conf.Address, conf.Conf.Port)
|
||||
log.Infof("start server @ %s", base)
|
||||
err := r.Run(base)
|
||||
var err error
|
||||
if conf.Conf.Https {
|
||||
err = r.RunTLS(base, conf.Conf.CertFile, conf.Conf.KeyFile)
|
||||
} else {
|
||||
err = r.Run(base)
|
||||
}
|
||||
if err != nil {
|
||||
log.Errorf("failed to start: %s", err.Error())
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ type Config struct {
|
|||
Address string `json:"address"`
|
||||
Port int `json:"port"`
|
||||
Database Database `json:"database"`
|
||||
Https bool `json:"https"`
|
||||
CertFile string `json:"cert_file"`
|
||||
KeyFile string `json:"key_file"`
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
|
@ -22,11 +25,7 @@ func DefaultConfig() *Config {
|
|||
Port: 5244,
|
||||
Database: Database{
|
||||
Type: "sqlite3",
|
||||
User: "",
|
||||
Password: "",
|
||||
Host: "",
|
||||
Port: 0,
|
||||
Name: "",
|
||||
TablePrefix: "x_",
|
||||
DBFile: "data/data.db",
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue