mirror of
https://github.com/openziti/zrok.git
synced 2025-08-18 11:49:51 +02:00
slight reworking on the configuration-based invite system to include open registration flag, contact details, and store strategy. moved to 'admin' stanza (#229)
This commit is contained in:
@@ -19,18 +19,14 @@ func newConfigurationHandler(cfg *config.Config) *configurationHandler {
|
||||
}
|
||||
|
||||
func (ch *configurationHandler) Handle(_ metadata.ConfigurationParams) middleware.Responder {
|
||||
tou := ""
|
||||
if cfg.Admin != nil {
|
||||
tou = cfg.Admin.TouLink
|
||||
}
|
||||
tokenRequired := false
|
||||
if cfg.Registration != nil {
|
||||
tokenRequired = cfg.Registration.TokenStrategy == "store"
|
||||
}
|
||||
data := &rest_model_zrok.Configuration{
|
||||
Version: build.String(),
|
||||
TouLink: tou,
|
||||
RegistrationRequiresToken: tokenRequired,
|
||||
Version: build.String(),
|
||||
InvitesOpen: cfg.Admin != nil && cfg.Admin.InvitesOpen,
|
||||
RequiresInviteToken: cfg.Registration != nil && cfg.Admin.InviteTokenStrategy == "store",
|
||||
}
|
||||
if cfg.Admin != nil {
|
||||
data.TouLink = cfg.Admin.TouLink
|
||||
data.InviteTokenContact = cfg.Admin.InviteTokenContact
|
||||
}
|
||||
return metadata.NewConfigurationOK().WithPayload(data)
|
||||
}
|
||||
|
Reference in New Issue
Block a user