mirror of
https://github.com/openziti/zrok.git
synced 2025-08-18 11:49:51 +02:00
added configuration endpoint which sends tou link and version info
This commit is contained in:
30
controller/configuration.go
Normal file
30
controller/configuration.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti/zrok/build"
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
"github.com/openziti/zrok/rest_server_zrok/operations/metadata"
|
||||
)
|
||||
|
||||
type configurationHandler struct {
|
||||
cfg *Config
|
||||
}
|
||||
|
||||
func newConfigurationHandler(cfg *Config) *configurationHandler {
|
||||
return &configurationHandler{
|
||||
cfg: cfg,
|
||||
}
|
||||
}
|
||||
|
||||
func (ch *configurationHandler) Handle(_ metadata.ConfigurationParams) middleware.Responder {
|
||||
tou := ""
|
||||
if cfg.Admin != nil {
|
||||
tou = cfg.Admin.TouLink
|
||||
}
|
||||
data := &rest_model_zrok.Configuration{
|
||||
Version: build.String(),
|
||||
TouLink: tou,
|
||||
}
|
||||
return metadata.NewConfigurationOK().WithPayload(data)
|
||||
}
|
Reference in New Issue
Block a user