Drone CI and linting (#14)
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
func GetConfiguration(options map[string]string) {
|
||||
url := "http://" + options["server"] + "/_api/configuration"
|
||||
|
||||
log.Info().Msg("Getting configuration from giredore server...")
|
||||
|
||||
data, err := requester.Get(url)
|
||||
@@ -23,6 +24,7 @@ func GetConfiguration(options map[string]string) {
|
||||
|
||||
func SetAllowedIPs(args []string, options map[string]string) {
|
||||
url := "http://" + options["server"] + "/_api/configuration/allowedips"
|
||||
|
||||
log.Info().Str("allowed IPs", args[0]).Msg("Setting allowed IPs for API interaction...")
|
||||
|
||||
req := &structs.AllowedIPsSetRequest{
|
||||
|
@@ -17,6 +17,7 @@ func DeletePackage(args []string, options map[string]string) {
|
||||
log.Info().Str("original path", req.OriginalPath).Msg("Sending package deletion request to giredored...")
|
||||
|
||||
url := "http://" + options["server"] + "/_api/packages"
|
||||
|
||||
data, err := requester.Delete(url, req)
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to send package deletion request to giredored")
|
||||
@@ -36,6 +37,7 @@ func GetPackages(args []string, options map[string]string) {
|
||||
}
|
||||
|
||||
url := "http://" + options["server"] + "/_api/packages"
|
||||
|
||||
log.Info().Msg("Getting packages data from giredore server...")
|
||||
|
||||
data, err := requester.Post(url, req)
|
||||
@@ -57,6 +59,7 @@ func SetPackage(args []string, options map[string]string) {
|
||||
log.Info().Str("description", pkg.Description).Str("original path", pkg.OriginalPath).Str("real path", pkg.RealPath).Str("VCS", pkg.VCS).Msg("Sending set/update request to giredored...")
|
||||
|
||||
url := "http://" + options["server"] + "/_api/packages"
|
||||
|
||||
data, err := requester.Put(url, pkg)
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to send package update/set request to giredored")
|
||||
|
@@ -18,7 +18,9 @@ func throwGoImports(ec echo.Context) error {
|
||||
// to list available packages.
|
||||
// For now only package itself is supported, all other features in ToDo.
|
||||
packageNameRaw := ec.Request().URL.Path
|
||||
|
||||
pkgs, errs := configuration.Cfg.GetPackagesInfo([]string{packageNameRaw})
|
||||
|
||||
if errs != nil {
|
||||
log.Error().Str("package", packageNameRaw).Msgf("Failed to get package information: %+v", errs)
|
||||
return ec.JSON(http.StatusBadRequest, &structs.Reply{Status: structs.StatusFailure, Errors: errs})
|
||||
|
@@ -24,7 +24,9 @@ func packagesGET(ec echo.Context) error {
|
||||
log.Info().Msgf("Received package(s) info get request: %+v", req)
|
||||
|
||||
var pkgs map[string]*structs.Package
|
||||
|
||||
var errors []structs.Error
|
||||
|
||||
if req.All {
|
||||
pkgs = configuration.Cfg.GetAllPackagesInfo()
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user