giredore/domains/server/v1/exported.go
Stanislav N. aka pztrn 6ce7747dd5
Working with packages and allowed IPs.
giredorectl now able to interact with giredored about:

* Setting package data. There is no such thing as "create" or "update",
just set.

* Deleting package data.

* Setting allowed IP addresses. This is the only authorization method
ATM, more may come in future.
2019-10-07 18:21:26 +05:00

32 lines
803 B
Go

package serverv1
import (
// local
"sources.dev.pztrn.name/pztrn/giredore/internal/httpserver"
"sources.dev.pztrn.name/pztrn/giredore/internal/logger"
// other
"github.com/rs/zerolog"
)
var (
log zerolog.Logger
)
func Initialize() {
log = logger.Logger.With().Str("type", "domain").Str("package", "server").Int("version", 1).Logger()
log.Info().Msg("Initializing...")
// Configuration-related.
httpserver.Srv.GET("/_api/configuration", configurationGET)
httpserver.Srv.POST("/_api/configuration/allowedips", configurationAllowedIPsSET)
// Packages-related.
httpserver.Srv.POST("/_api/packages", packagesGET)
httpserver.Srv.PUT("/_api/packages", packagesSET)
httpserver.Srv.DELETE("/_api/packages", packagesDELETE)
// goimports serving.
httpserver.Srv.GET("/*", throwGoImports)
}