🎇 support https

This commit is contained in:
微凉
2021-12-01 00:19:06 +08:00
parent bd91acc5d0
commit 944941db10
2 changed files with 9 additions and 5 deletions

View File

@ -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())
}