Relax URLs validation

Webhook URL was not mandatory in previous versions. While it is needed
if users plan to use the install webhook feature, it is not required if
you want to install it yourself.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2025-02-05 20:10:02 +00:00
parent 001465d0a2
commit 86d6517a5d
2 changed files with 2 additions and 2 deletions

View file

@ -39,6 +39,6 @@ var (
// URLsRequired is returned if the controller does not have the required URLs // URLsRequired is returned if the controller does not have the required URLs
URLsRequired = APIErrorResponse{ URLsRequired = APIErrorResponse{
Error: "urls_required", Error: "urls_required",
Details: "Missing required URLs. Make sure you update the metadata, callback and webhook URLs", Details: "Missing required URLs. Make sure you update the metadata and callback URLs",
} }
) )

View file

@ -66,7 +66,7 @@ func (u *urlsRequired) Middleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context() ctx := r.Context()
ctrlInfo, err := u.store.ControllerInfo() ctrlInfo, err := u.store.ControllerInfo()
if err != nil || ctrlInfo.WebhookURL == "" || ctrlInfo.MetadataURL == "" || ctrlInfo.CallbackURL == "" { if err != nil || ctrlInfo.MetadataURL == "" || ctrlInfo.CallbackURL == "" {
w.Header().Add("Content-Type", "application/json") w.Header().Add("Content-Type", "application/json")
w.WriteHeader(http.StatusConflict) w.WriteHeader(http.StatusConflict)
if err := json.NewEncoder(w).Encode(params.URLsRequired); err != nil { if err := json.NewEncoder(w).Encode(params.URLsRequired); err != nil {