Move to mirrorred images for Drone and Dockerfile, linting fixes.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -27,7 +27,7 @@ func DeletePackage(args []string, options map[string]string) {
|
||||
func GetPackages(args []string, options map[string]string) {
|
||||
pkgs := strings.Split(args[0], ",")
|
||||
|
||||
// nolint:exhaustivestruct
|
||||
// nolint:exhaustruct
|
||||
req := &structs.PackageGetRequest{}
|
||||
if pkgs[0] == "all" {
|
||||
req.All = true
|
||||
|
@@ -15,11 +15,11 @@ func configurationGET(ec echo.Context) error {
|
||||
}
|
||||
|
||||
func configurationAllowedIPsSET(ectx echo.Context) error {
|
||||
// nolint:exhaustivestruct
|
||||
// nolint:exhaustruct
|
||||
req := &structs.AllowedIPsSetRequest{}
|
||||
if err := ectx.Bind(req); err != nil {
|
||||
log.Error().Err(err).Msg("Failed to parse allowed IPs set request")
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusBadRequest, &structs.Reply{Status: structs.StatusFailure, Errors: []structs.Error{structs.ErrParsingAllowedIPsSetRequest}})
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@ func configurationAllowedIPsSET(ectx echo.Context) error {
|
||||
|
||||
configuration.Cfg.SetAllowedIPs(req.AllowedIPs)
|
||||
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusOK, &structs.Reply{Status: structs.StatusSuccess})
|
||||
}
|
||||
|
@@ -20,18 +20,18 @@ func throwGoImports(ectx echo.Context) error {
|
||||
if errs != nil {
|
||||
log.Error().Str("package", packageNameRaw).Msgf("Failed to get package information: %+v", errs)
|
||||
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusBadRequest, &structs.Reply{Status: structs.StatusFailure, Errors: errs})
|
||||
}
|
||||
|
||||
if len(pkgs) == 0 {
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusBadRequest, &structs.Reply{Status: structs.StatusFailure, Errors: []structs.Error{structs.ErrNoPackagesFound}})
|
||||
}
|
||||
|
||||
pkg, found := pkgs[packageNameRaw]
|
||||
if !found {
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusBadRequest, &structs.Reply{Status: structs.StatusFailure, Errors: []structs.Error{structs.ErrNoPackagesFound}})
|
||||
}
|
||||
|
||||
|
@@ -11,12 +11,12 @@ import (
|
||||
|
||||
// This function responsible for getting packages configuration.
|
||||
func packagesGET(ectx echo.Context) error {
|
||||
// nolint:exhaustivestruct
|
||||
// nolint:exhaustruct
|
||||
req := &structs.PackageGetRequest{}
|
||||
if err := ectx.Bind(req); err != nil {
|
||||
log.Error().Err(err).Msg("Failed to parse package get request")
|
||||
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusBadRequest, &structs.Reply{Status: structs.StatusFailure, Errors: []structs.Error{structs.ErrParsingPackagesGetRequest}})
|
||||
}
|
||||
|
||||
@@ -37,18 +37,18 @@ func packagesGET(ectx echo.Context) error {
|
||||
return ectx.JSON(http.StatusBadRequest, &structs.Reply{Status: structs.StatusFailure, Errors: errors, Data: pkgs})
|
||||
}
|
||||
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusOK, &structs.Reply{Status: structs.StatusSuccess, Data: pkgs})
|
||||
}
|
||||
|
||||
// This function responsible for deleting package.
|
||||
func packagesDELETE(ectx echo.Context) error {
|
||||
// nolint:exhaustivestruct
|
||||
// nolint:exhaustruct
|
||||
req := &structs.PackageDeleteRequest{}
|
||||
if err := ectx.Bind(req); err != nil {
|
||||
log.Error().Err(err).Msg("Failed to parse package delete request")
|
||||
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusBadRequest, &structs.Reply{Status: structs.StatusFailure, Errors: []structs.Error{structs.ErrParsingDeleteRequest}})
|
||||
}
|
||||
|
||||
@@ -57,17 +57,17 @@ func packagesDELETE(ectx echo.Context) error {
|
||||
errs := configuration.Cfg.DeletePackage(req)
|
||||
|
||||
if len(errs) > 0 {
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusBadRequest, &structs.Reply{Status: structs.StatusFailure, Errors: errs})
|
||||
}
|
||||
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusOK, &structs.Reply{Status: structs.StatusSuccess})
|
||||
}
|
||||
|
||||
// This function responsible for setting or updating packages.
|
||||
func packagesSET(ectx echo.Context) error {
|
||||
// nolint:exhaustivestruct
|
||||
// nolint:exhaustruct
|
||||
req := &structs.Package{}
|
||||
if err := ectx.Bind(req); err != nil {
|
||||
log.Error().Err(err).Msg("Failed to parse package data")
|
||||
@@ -80,12 +80,12 @@ func packagesSET(ectx echo.Context) error {
|
||||
|
||||
// Validate passed package data.
|
||||
if !strings.HasPrefix(req.OriginalPath, "/") {
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusBadRequest, &structs.Reply{Status: structs.StatusFailure, Errors: []structs.Error{structs.ErrPackageOrigPathShouldStartWithSlash}})
|
||||
}
|
||||
|
||||
configuration.Cfg.AddOrUpdatePackage(req)
|
||||
|
||||
// nolint:exhaustivestruct,wrapcheck
|
||||
// nolint:exhaustruct,wrapcheck
|
||||
return ectx.JSON(http.StatusOK, &structs.Reply{Status: structs.StatusSuccess})
|
||||
}
|
||||
|
Reference in New Issue
Block a user