updates for configuration changes.
This commit is contained in:
parent
0ea59c1f23
commit
d0bc1b72c6
@ -1,7 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
/*
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"mutating-webhook/internal/config"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -20,15 +21,15 @@ func crossSiteOrigin(w http.ResponseWriter) {
|
|||||||
w.Header().Add("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, Authorization, X-API-Token")
|
w.Header().Add("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, Authorization, X-API-Token")
|
||||||
}
|
}
|
||||||
|
|
||||||
func httpServer(host string, port int) {
|
func httpServer(cfg *config.Config) {
|
||||||
path := http.NewServeMux()
|
path := http.NewServeMux()
|
||||||
|
|
||||||
connection := &http.Server{
|
connection := &http.Server{
|
||||||
Addr: host + ":" + strconv.FormatInt(int64(port), 10),
|
Addr: cfg.WebServerIP + ":" + strconv.FormatInt(int64(cfg.WebServerPort), 10),
|
||||||
Handler: path,
|
Handler: path,
|
||||||
ReadTimeout: time.Duration(config.WebSrvReadTimeout) * time.Second,
|
ReadTimeout: time.Duration(cfg.WebServerReadTimeout) * time.Second,
|
||||||
WriteTimeout: time.Duration(config.WebSrvWriteTimeout) * time.Second,
|
WriteTimeout: time.Duration(cfg.WebServerWriteTimeout) * time.Second,
|
||||||
IdleTimeout: time.Duration(config.WebSrvIdleTimeout) * time.Second,
|
IdleTimeout: time.Duration(cfg.WebServerIdleTimeout) * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
// healthcheck
|
// healthcheck
|
||||||
@ -70,4 +71,3 @@ func webHealthCheck(w http.ResponseWriter, r *http.Request) {
|
|||||||
tmpltError(w, http.StatusBadRequest, InvalidMethod)
|
tmpltError(w, http.StatusBadRequest, InvalidMethod)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
@ -23,9 +23,9 @@ func main() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
// initialize application configuration
|
// initialize application configuration
|
||||||
initialize.Init()
|
cfg := initialize.Init()
|
||||||
|
|
||||||
//go httpServer(cfg.WebSrvIP, cfg.WebSrvPort)
|
go httpServer(cfg)
|
||||||
|
|
||||||
forever()
|
forever()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user