Add UseTLS config param for non-encrypted debugging
This commit is contained in:
parent
c0a02d1194
commit
59c18fdaff
|
@ -14,6 +14,7 @@ import (
|
|||
)
|
||||
|
||||
type config struct {
|
||||
UseTLS bool `json:"useTLS"`
|
||||
Servers []server `json:"servers"`
|
||||
}
|
||||
|
||||
|
@ -111,6 +112,8 @@ func main() {
|
|||
t.Execute(w, data)
|
||||
})
|
||||
|
||||
if config.UseTLS {
|
||||
|
||||
certManager := autocert.Manager{
|
||||
Prompt: autocert.AcceptTOS,
|
||||
HostPolicy: autocert.HostWhitelist("factorio.blackolivepineapple.pizza"), // TODO: add config
|
||||
|
@ -129,4 +132,9 @@ func main() {
|
|||
fmt.Println("Serving...")
|
||||
srv.ListenAndServeTLS("", "") // Key/cert come from srv.TLSConfig
|
||||
|
||||
} else { // Debug
|
||||
fmt.Println("Serving...")
|
||||
http.ListenAndServe(":8080", nil) // TODO: pass as config value
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue