MCPcopy Index your code
hub / github.com/ContentSquare/chproxy / startHTTP

Function startHTTP

main_test.go:1065–1085  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1063}
1064
1065func startHTTP() (*http.Server, chan struct{}) {
1066 cfg, err := loadConfig()
1067 if err != nil {
1068 panic(fmt.Sprintf("error while loading config: %s", err))
1069 }
1070 if err = applyConfig(cfg); err != nil {
1071 panic(fmt.Sprintf("error while applying config: %s", err))
1072 }
1073 done := make(chan struct{})
1074 ln, err := net.Listen("tcp4", cfg.Server.HTTP.ListenAddr)
1075 if err != nil {
1076 panic(fmt.Sprintf("cannot listen for %q: %s", cfg.Server.HTTP.ListenAddr, err))
1077 }
1078 h := http.HandlerFunc(serveHTTP)
1079 s := newServer(ln, h, config.TimeoutCfg{})
1080 go func() {
1081 s.Serve(ln)
1082 close(done)
1083 }()
1084 return s, done
1085}
1086
1087// TODO randomise port for each instance of the mock
1088func startRedis(t *testing.T) *miniredis.Miniredis {

Callers

nothing calls this directly

Calls 3

loadConfigFunction · 0.85
applyConfigFunction · 0.85
newServerFunction · 0.85

Tested by

no test coverage detected