Skip to content

Commit

Permalink
fix(#91): try to fix TLS error
Browse files Browse the repository at this point in the history
  • Loading branch information
zaigie committed Feb 4, 2024
1 parent 0eaa96c commit 61ce4d2
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,8 @@ func main() {

go func() {
if viper.GetBool("web.tls") {
certFile, err := os.ReadFile(viper.GetString("web.cert_path"))
if err != nil {
panic("Failed to read cert file")
}
keyFile, err := os.ReadFile(viper.GetString("web.key_path"))
if err != nil {
panic("Failed to read key file")
}

if err := router.RunTLS(fmt.Sprintf(":%d", viper.GetInt("web.port")), string(certFile), string(keyFile)); err != nil {
logger.Errorf("Server exited with error: %v\n", err)
if err := router.RunTLS(fmt.Sprintf(":%d", viper.GetInt("web.port")), viper.GetString("web.cert_path"), viper.GetString("web.key_path")); err != nil {
logger.Errorf("Server exited with TLS error: %v\n", err)
}
} else {
if err := router.Run(fmt.Sprintf(":%d", viper.GetInt("web.port"))); err != nil {
Expand Down

0 comments on commit 61ce4d2

Please sign in to comment.