mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
feat(templates): re-introduce external template management (#2119)
* feat(templates): re-introduce external template management * refactor(api): review error handling
This commit is contained in:
parent
09cb8e7350
commit
ee9c8d7d1a
12 changed files with 120 additions and 32 deletions
|
@ -19,6 +19,7 @@ type settingsUpdatePayload struct {
|
|||
AllowBindMountsForRegularUsers *bool
|
||||
AllowPrivilegedModeForRegularUsers *bool
|
||||
SnapshotInterval *string
|
||||
TemplatesURL *string
|
||||
}
|
||||
|
||||
func (payload *settingsUpdatePayload) Validate(r *http.Request) error {
|
||||
|
@ -28,6 +29,9 @@ func (payload *settingsUpdatePayload) Validate(r *http.Request) error {
|
|||
if payload.LogoURL != nil && *payload.LogoURL != "" && !govalidator.IsURL(*payload.LogoURL) {
|
||||
return portainer.Error("Invalid logo URL. Must correspond to a valid URL format")
|
||||
}
|
||||
if payload.TemplatesURL != nil && *payload.TemplatesURL != "" && !govalidator.IsURL(*payload.TemplatesURL) {
|
||||
return portainer.Error("Invalid external templates URL. Must correspond to a valid URL format")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -52,6 +56,10 @@ func (handler *Handler) settingsUpdate(w http.ResponseWriter, r *http.Request) *
|
|||
settings.LogoURL = *payload.LogoURL
|
||||
}
|
||||
|
||||
if payload.TemplatesURL != nil {
|
||||
settings.TemplatesURL = *payload.TemplatesURL
|
||||
}
|
||||
|
||||
if payload.BlackListedLabels != nil {
|
||||
settings.BlackListedLabels = payload.BlackListedLabels
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue