Settings: Rename constants/variables to follow Go naming standards (#28002)
* settings: Rename constants/variables to follow Go naming standards Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -106,11 +106,11 @@ func (hs *HTTPServer) Run(ctx context.Context) error {
|
||||
Handler: hs.macaron,
|
||||
}
|
||||
switch setting.Protocol {
|
||||
case setting.HTTP2:
|
||||
case setting.HTTP2Scheme:
|
||||
if err := hs.configureHttp2(); err != nil {
|
||||
return err
|
||||
}
|
||||
case setting.HTTPS:
|
||||
case setting.HTTPSScheme:
|
||||
if err := hs.configureHttps(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -138,7 +138,7 @@ func (hs *HTTPServer) Run(ctx context.Context) error {
|
||||
}()
|
||||
|
||||
switch setting.Protocol {
|
||||
case setting.HTTP, setting.SOCKET:
|
||||
case setting.HTTPScheme, setting.SocketScheme:
|
||||
if err := hs.httpSrv.Serve(listener); err != nil {
|
||||
if err == http.ErrServerClosed {
|
||||
hs.log.Debug("server was shutdown gracefully")
|
||||
@@ -146,7 +146,7 @@ func (hs *HTTPServer) Run(ctx context.Context) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
case setting.HTTP2, setting.HTTPS:
|
||||
case setting.HTTP2Scheme, setting.HTTPSScheme:
|
||||
if err := hs.httpSrv.ServeTLS(listener, setting.CertFile, setting.KeyFile); err != nil {
|
||||
if err == http.ErrServerClosed {
|
||||
hs.log.Debug("server was shutdown gracefully")
|
||||
@@ -169,13 +169,13 @@ func (hs *HTTPServer) getListener() (net.Listener, error) {
|
||||
}
|
||||
|
||||
switch setting.Protocol {
|
||||
case setting.HTTP, setting.HTTPS, setting.HTTP2:
|
||||
case setting.HTTPScheme, setting.HTTPSScheme, setting.HTTP2Scheme:
|
||||
listener, err := net.Listen("tcp", hs.httpSrv.Addr)
|
||||
if err != nil {
|
||||
return nil, errutil.Wrapf(err, "failed to open listener on address %s", hs.httpSrv.Addr)
|
||||
}
|
||||
return listener, nil
|
||||
case setting.SOCKET:
|
||||
case setting.SocketScheme:
|
||||
listener, err := net.ListenUnix("unix", &net.UnixAddr{Name: setting.SocketPath, Net: "unix"})
|
||||
if err != nil {
|
||||
return nil, errutil.Wrapf(err, "failed to open listener for socket %s", setting.SocketPath)
|
||||
@@ -437,7 +437,7 @@ func (hs *HTTPServer) mapStatic(m *macaron.Macaron, rootDir string, dir string,
|
||||
}
|
||||
}
|
||||
|
||||
if setting.Env == setting.DEV {
|
||||
if setting.Env == setting.Dev {
|
||||
headers = func(c *macaron.Context) {
|
||||
c.Resp.Header().Set("Cache-Control", "max-age=0, must-revalidate, no-cache")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user