2019-10-05 21:53:22 +05:00
|
|
|
package serverv1
|
|
|
|
|
|
|
|
import (
|
|
|
|
// local
|
2019-10-13 15:12:54 +05:00
|
|
|
"go.dev.pztrn.name/giredore/internal/httpserver"
|
|
|
|
"go.dev.pztrn.name/giredore/internal/logger"
|
2019-10-05 21:53:22 +05:00
|
|
|
|
|
|
|
// 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...")
|
|
|
|
|
2019-10-07 18:21:26 +05:00
|
|
|
// Configuration-related.
|
2019-10-05 21:53:22 +05:00
|
|
|
httpserver.Srv.GET("/_api/configuration", configurationGET)
|
2019-10-07 18:21:26 +05:00
|
|
|
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)
|
2019-10-05 21:53:22 +05:00
|
|
|
}
|