Move to mirrorred images for Drone and Dockerfile, linting fixes.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-06-29 15:04:57 +05:00
parent 899c406f09
commit 9e5f98a413
13 changed files with 44 additions and 40 deletions

View File

@@ -16,11 +16,11 @@ func Initialize() {
log = logger.Logger.With().Str("type", "internal").Str("package", "configuration").Logger()
log.Info().Msg("Initializing...")
// nolint:exhaustivestruct
// nolint:exhaustruct
envCfg = &envConfig{}
envCfg.Initialize()
// nolint:exhaustivestruct
// nolint:exhaustruct
Cfg = &fileConfig{}
Cfg.Initialize()

View File

@@ -35,7 +35,7 @@ func checkAllowedIPs() echo.MiddlewareFunc {
if err != nil {
log.Error().Err(err).Str("subnet", ipToParse).Msg("Failed to parse CIDR. /_api/ endpoint won't be accessible, this should be fixed manually in configuration file!")
// nolint:exhaustivestruct,wrapcheck
// nolint:exhaustruct,wrapcheck
return ectx.JSON(http.StatusInternalServerError, &structs.Reply{Status: structs.StatusFailure, Errors: []structs.Error{structs.ErrInvalidAllowedIPDefined}})
}
@@ -60,7 +60,7 @@ func checkAllowedIPs() echo.MiddlewareFunc {
return next(ectx)
}
// nolint:exhaustivestruct,wrapcheck
// nolint:exhaustruct,wrapcheck
return ectx.JSON(http.StatusBadRequest, &structs.Reply{Status: structs.StatusFailure, Errors: []structs.Error{structs.ErrIPAddressNotAllowed}})
}
}

View File

@@ -62,7 +62,7 @@ func Start() {
}()
// Check that HTTP server was started.
// nolint:exhaustivestruct
// nolint:exhaustruct
httpc := &http.Client{Timeout: time.Second * 1}
checks := 0

View File

@@ -44,32 +44,32 @@ func Initialize() {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
}
// nolint:exhaustivestruct
// nolint:exhaustruct
output := zerolog.ConsoleWriter{Out: os.Stdout, NoColor: false, TimeFormat: time.RFC3339}
output.FormatLevel = func(lvlRaw interface{}) string {
var v string
var formattedLvl string
if lvl, ok := lvlRaw.(string); ok {
lvl = strings.ToUpper(lvl)
switch lvl {
case "DEBUG":
v = fmt.Sprintf("\x1b[30m%-5s\x1b[0m", lvl)
formattedLvl = fmt.Sprintf("\x1b[30m%-5s\x1b[0m", lvl)
case "ERROR":
v = fmt.Sprintf("\x1b[31m%-5s\x1b[0m", lvl)
formattedLvl = fmt.Sprintf("\x1b[31m%-5s\x1b[0m", lvl)
case "FATAL":
v = fmt.Sprintf("\x1b[35m%-5s\x1b[0m", lvl)
formattedLvl = fmt.Sprintf("\x1b[35m%-5s\x1b[0m", lvl)
case "INFO":
v = fmt.Sprintf("\x1b[32m%-5s\x1b[0m", lvl)
formattedLvl = fmt.Sprintf("\x1b[32m%-5s\x1b[0m", lvl)
case "PANIC":
v = fmt.Sprintf("\x1b[36m%-5s\x1b[0m", lvl)
formattedLvl = fmt.Sprintf("\x1b[36m%-5s\x1b[0m", lvl)
case "WARN":
v = fmt.Sprintf("\x1b[33m%-5s\x1b[0m", lvl)
formattedLvl = fmt.Sprintf("\x1b[33m%-5s\x1b[0m", lvl)
default:
v = lvl
formattedLvl = lvl
}
}
return fmt.Sprintf("| %s |", v)
return fmt.Sprintf("| %s |", formattedLvl)
}
Logger = zerolog.New(output).With().Timestamp().Logger()

View File

@@ -30,6 +30,7 @@ func execRequest(method string, url string, data interface{}) ([]byte, error) {
var dataToSend []byte
if data != nil {
// nolint:errchkjson
dataToSend, _ = json.Marshal(data)
}

View File

@@ -8,6 +8,7 @@ import (
// nolint:exhaustivestruct
func getHTTPClient() *http.Client {
// nolint:exhaustruct
client := &http.Client{
Transport: &http.Transport{
ExpectContinueTimeout: time.Second * 5,