Skip to content

Modern Docker Management, Designed for Everyone

refactor: remove deprecated services and logic (#2722)

Kyle Mendell576865d1472e
diff --git a/backend/api/api.go b/backend/api/api.go
index 0d3d2143b..a236f7c79 100644
--- a/backend/api/api.go
+++ b/backend/api/api.go
@@ -164,7 +164,6 @@ type Services struct {
Port *services.PortService
Swarm *services.SwarmService
Notification *services.NotificationService
- Apprise *services.AppriseService //nolint:staticcheck // Apprise still functional, deprecated in favor of Shoutrrr
Updater *services.UpdaterService
CustomizeSearch *services.CustomizeSearchService
System *services.SystemService
@@ -337,7 +336,6 @@ func registerHandlers(api huma.API, svc *Services) {
var portSvc *services.PortService
var swarmSvc *services.SwarmService
var notificationSvc *services.NotificationService
- var appriseSvc *services.AppriseService //nolint:staticcheck // Apprise still functional, deprecated in favor of Shoutrrr
var updaterSvc *services.UpdaterService
var customizeSearchSvc *services.CustomizeSearchService
var systemSvc *services.SystemService
@@ -376,7 +374,6 @@ func registerHandlers(api huma.API, svc *Services) {
portSvc = svc.Port
swarmSvc = svc.Swarm
notificationSvc = svc.Notification
- appriseSvc = svc.Apprise
updaterSvc = svc.Updater
customizeSearchSvc = svc.CustomizeSearch
systemSvc = svc.System
@@ -411,7 +408,7 @@ func registerHandlers(api huma.API, svc *Services) {
handlers.RegisterPorts(api, portSvc)
handlers.RegisterNetworks(api, networkSvc, dockerSvc)
handlers.RegisterSwarm(api, swarmSvc, environmentSvc, eventSvc, cfg)
- handlers.RegisterNotifications(api, notificationSvc, appriseSvc, cfg)
+ handlers.RegisterNotifications(api, notificationSvc, cfg)
handlers.RegisterUpdater(api, updaterSvc)
handlers.RegisterCustomize(api, customizeSearchSvc)
handlers.RegisterSystem(api, dockerSvc, systemSvc, systemUpgradeSvc, cfg)
diff --git a/backend/api/handlers/container_registries.go b/backend/api/handlers/container_registries.go
index 010104329..f8ebf01b6 100644
--- a/backend/api/handlers/container_registries.go
+++ b/backend/api/handlers/container_registries.go
@@ -229,7 +229,7 @@ func (h *ContainerRegistryHandler) ListRegistries(ctx context.Context, input *Li
return nil, huma.Error500InternalServerError("service not available")
}
- params := buildPaginationParamsInternal(0, input.Start, input.Limit, input.Sort, input.Order, input.Search)
+ params := buildPaginationParamsInternal(input.Start, input.Limit, input.Sort, input.Order, input.Search)
registries, paginationResp, err := h.registryService.GetRegistriesPaginated(ctx, params)
if err != nil {
diff --git a/backend/api/handlers/environments.go b/backend/api/handlers/environments.go
index af747fa6a..dc137827a 100644
--- a/backend/api/handlers/environments.go
+++ b/backend/api/handlers/environments.go
@@ -550,15 +550,7 @@ func (h *EnvironmentHandler) createEnvironmentWithApiKey(ctx context.Context, en
}
func (h *EnvironmentHandler) createEnvironmentLegacy(ctx context.Context, env *models.Environment, user *models.User, body environment.Create) (*CreateEnvironmentOutput, error) {
- // Legacy pairing flows
- if (body.AccessToken == nil || *body.AccessToken == "") && body.BootstrapToken != nil && *body.BootstrapToken != "" {
- token, err := h.environmentService.PairAgentWithBootstrap(ctx, body.ApiUrl, *body.BootstrapToken)
- if err != nil {
- slog.ErrorContext(ctx, "Failed to pair with agent", "apiUrl", body.ApiUrl, "error", err.Error())
- return nil, huma.Error502BadGateway((&common.AgentPairingError{Err: err}).Error())
- }
- env.AccessToken = &token
- } else if body.AccessToken != nil && *body.AccessToken != "" {
+ if body.AccessToken != nil && *body.AccessToken != "" {
env.AccessToken = body.AccessToken
}
@@ -891,32 +883,17 @@ func (h *EnvironmentHandler) buildUpdateMap(req *environment.Update, isLocalEnv
}
func (h *EnvironmentHandler) handleEnvironmentPairing(ctx context.Context, environmentID string, req *environment.Update, updates map[string]any, isLocalEnv bool) (bool, error) {
- pairingSucceeded := false
-
+ _ = ctx
+ _ = environmentID
if isLocalEnv {
- return pairingSucceeded, nil
+ return false, nil
}
- if req.AccessToken == nil && req.BootstrapToken != nil && *req.BootstrapToken != "" {
- current, err := h.environmentService.GetEnvironmentByID(ctx, environmentID)
- if err != nil || current == nil {
- return false, huma.Error404NotFound("Environment not found")
- }
-
- apiUrl := current.ApiUrl
- if req.ApiUrl != nil && *req.ApiUrl != "" {
- apiUrl = *req.ApiUrl
- }
-
- if _, err := h.environmentService.PairAndPersistAgentToken(ctx, environmentID, apiUrl, *req.BootstrapToken); err != nil {
- return false, huma.Error502BadGateway("Agent pairing failed: " + err.Error())
- }
- pairingSucceeded = true
- } else if req.AccessToken != nil {
+ if req.AccessToken != nil {
updates["access_token"] = *req.AccessToken
}
- return pairingSucceeded, nil
+ return false, nil
}
func (h *EnvironmentHandler) triggerPostUpdateTasks(ctx context.Context, environmentID string, updated *models.Environment, pairingSucceeded bool, req *environment.Update) { //nolint:contextcheck // intentionally spawns background tasks
diff --git a/backend/api/handlers/events.go b/backend/api/handlers/events.go
index ae15b22ee..5d0ff6658 100644
--- a/backend/api/handlers/events.go
+++ b/backend/api/handlers/events.go
@@ -156,7 +156,7 @@ func (h *EventHandler) ListEvents(ctx context.Context, input *ListEventsInput) (
return nil, err
}
- params := buildPaginationParamsInternal(0, input.Start, input.Limit, input.Sort, input.Order, input.Search)
+ params := buildPaginationParamsInternal(input.Start, input.Limit, input.Sort, input.Order, input.Search)
if input.Severity != "" {
params.Filters["severity"] = input.Severity
@@ -199,7 +199,7 @@ func (h *EventHandler) GetEventsByEnvironment(ctx context.Context, input *GetEve
return nil, huma.Error400BadRequest((&common.EnvironmentIDRequiredError{}).Error())
}
- params := buildPaginationParamsInternal(0, input.Start, input.Limit, input.Sort, input.Order, input.Search)
+ params := buildPaginationParamsInternal(input.Start, input.Limit, input.Sort, input.Order, input.Search)
if input.Severity != "" {
params.Filters["severity"] = input.Severity
diff --git a/backend/api/handlers/git_repositories.go b/backend/api/handlers/git_repositories.go
index 8de9561fb..969b5aa2b 100644
--- a/backend/api/handlers/git_repositories.go
+++ b/backend/api/handlers/git_repositories.go
@@ -250,7 +250,7 @@ func (h *GitRepositoryHandler) ListRepositories(ctx context.Context, input *List
return nil, huma.Error500InternalServerError("service not available")
}
- params := buildPaginationParamsInternal(0, input.Start, input.Limit, input.Sort, input.Order, input.Search)
+ params := buildPaginationParamsInternal(input.Start, input.Limit, input.Sort, input.Order, input.Search)
repositories, paginationResp, err := h.repoService.GetRepositoriesPaginated(ctx, params)
if err != nil {
diff --git a/backend/api/handlers/gitops_syncs.go b/backend/api/handlers/gitops_syncs.go
index 7e9d0041b..5a4e9b150 100644
--- a/backend/api/handlers/gitops_syncs.go
+++ b/backend/api/handlers/gitops_syncs.go
@@ -258,7 +258,7 @@ func (h *GitOpsSyncHandler) ListSyncs(ctx context.Context, input *ListGitOpsSync
return nil, huma.Error500InternalServerError("service not available")
}
- params := buildPaginationParamsInternal(0, input.Start, input.Limit, input.Sort, input.Order, input.Search)
+ params := buildPaginationParamsInternal(input.Start, input.Limit, input.Sort, input.Order, input.Search)
syncs, paginationResp, counts, err := h.syncService.GetSyncsPaginated(ctx, input.EnvironmentID, params)
if err != nil {
diff --git a/backend/api/handlers/helpers.go b/backend/api/handlers/helpers.go
index e006f68a9..9ba903636 100644
--- a/backend/api/handlers/helpers.go
+++ b/backend/api/handlers/helpers.go
@@ -21,22 +21,14 @@ func checkAdminInternal(ctx context.Context) error {
}
// buildPaginationParamsInternal converts query parameters to pagination.QueryParams.
-// It supports both the legacy nested style (page/limit) and the standard style (start/limit).
// A limit of -1 means "show all items" (no pagination).
-func buildPaginationParamsInternal(page, start, limit int, sortCol, sortDir, search string) pagination.QueryParams {
+func buildPaginationParamsInternal(start, limit int, sortCol, sortDir, search string) pagination.QueryParams {
// limit = -1 means "show all", preserve it; zero or other negative values default to 20
if limit < -1 {
limit = 20
}
- finalStart := start
- if page > 1 && start == 0 && limit > 0 {
- // Convert page-based to offset-based if page is provided and start is 0
- // Skip this conversion when limit is -1 (show all)
- finalStart = (page - 1) * limit
- }
-
- params := pagination.QueryParams{
+ return pagination.QueryParams{
SearchQuery: pagination.SearchQuery{
Search: search,
},
@@ -45,12 +37,11 @@ func buildPaginationParamsInternal(page, start, limit int, sortCol, sortDir, sea
Order: pagination.SortOrder(sortDir),
},
PaginationParams: pagination.PaginationParams{
- Start: finalStart,
+ Start: start,
Limit: limit,
},
Filters: make(map[string]string),
}
- return params
}
func proxyRemoteJSONInternal[T any](
diff --git a/backend/api/handlers/images.go b/backend/api/handlers/images.go
index 00207682e..6dbb397d5 100644
--- a/backend/api/handlers/images.go
+++ b/backend/api/handlers/images.go
@@ -498,7 +498,7 @@ func (h *ImageHandler) ListImageBuilds(ctx context.Context, input *ListImageBuil
return nil, huma.Error400BadRequest((&common.EnvironmentIDRequiredError{}).Error())
}
- params := buildPaginationParamsInternal(0, input.Start, input.Limit, input.Sort, input.Order, input.Search)
+ params := buildPaginationParamsInternal(input.Start, input.Limit, input.Sort, input.Order, input.Search)
if input.Status != "" {
params.Filters["status"] = input.Status
}
diff --git a/backend/api/handlers/notifications.go b/backend/api/handlers/notifications.go
index 340b4c133..9efe5b09d 100644
--- a/backend/api/handlers/notifications.go
+++ b/backend/api/handlers/notifications.go
@@ -18,7 +18,6 @@ import (
type NotificationHandler struct {
notificationService *services.NotificationService
- appriseService *services.AppriseService //nolint:staticcheck // Apprise still functional, deprecated in favor of Shoutrrr
config *config.Config
}
@@ -67,32 +66,6 @@ type TestNotificationOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
-type GetAppriseSettingsInput struct {
- EnvironmentID string `path:"id" doc:"Environment ID"`
-}
-
-type GetAppriseSettingsOutput struct {
- Body notification.AppriseResponse
-}
-
-type CreateOrUpdateAppriseSettingsInput struct {
- EnvironmentID string `path:"id" doc:"Environment ID"`
- Body notification.AppriseUpdate
-}
-
-type CreateOrUpdateAppriseSettingsOutput struct {
- Body notification.AppriseResponse
-}
-
-type TestAppriseNotificationInput struct {
- EnvironmentID string `path:"id" doc:"Environment ID"`
- Type string `query:"type" default:"simple"`
-}
-
-type TestAppriseNotificationOutput struct {
- Body base.ApiResponse[base.MessageResponse]
-}
-
type DispatchNotificationInput struct {
APIKey string `header:"X-API-Key" doc:"Remote environment access token"`
Body notification.DispatchRequest
@@ -125,12 +98,9 @@ func isSupportedNotificationTestType(testType string) bool {
}
// RegisterNotifications registers notification endpoints.
-//
-//nolint:staticcheck // AppriseService still functional, deprecated in favor of Shoutrrr
-func RegisterNotifications(api huma.API, notificationSvc *services.NotificationService, appriseSvc *services.AppriseService, cfg *config.Config) {
+func RegisterNotifications(api huma.API, notificationSvc *services.NotificationService, cfg *config.Config) {
h := &NotificationHandler{
notificationService: notificationSvc,
- appriseService: appriseSvc,
config: cfg,
}
@@ -184,36 +154,6 @@ func RegisterNotifications(api huma.API, notificationSvc *services.NotificationS
Middlewares: humamw.RequireAdmin(api),
}, h.TestNotification)
- huma.Register(api, huma.Operation{
- OperationID: "get-apprise-settings",
- Method: http.MethodGet,
- Path: "/environments/{id}/notifications/apprise",
- Summary: "Get Apprise settings",
- Tags: []string{"Notifications"},
- Security: []map[string][]string{{"BearerAuth": {}}, {"ApiKeyAuth": {}}},
- Middlewares: humamw.RequireAdmin(api),
- }, h.GetAppriseSettings)
-
- huma.Register(api, huma.Operation{
- OperationID: "create-or-update-apprise-settings",
- Method: http.MethodPost,
- Path: "/environments/{id}/notifications/apprise",
- Summary: "Create or update Apprise settings",
- Tags: []string{"Notifications"},
- Security: []map[string][]string{{"BearerAuth": {}}, {"ApiKeyAuth": {}}},
- Middlewares: humamw.RequireAdmin(api),
- }, h.CreateOrUpdateAppriseSettings)
-
- huma.Register(api, huma.Operation{
- OperationID: "test-apprise-notification",
- Method: http.MethodPost,
- Path: "/environments/{id}/notifications/apprise/test",
- Summary: "Test Apprise notification",
- Tags: []string{"Notifications"},
- Security: []map[string][]string{{"BearerAuth": {}}, {"ApiKeyAuth": {}}},
- Middlewares: humamw.RequireAdmin(api),
- }, h.TestAppriseNotification)
-
huma.Register(api, huma.Operation{
OperationID: "dispatch-notification",
Method: http.MethodPost,
@@ -358,92 +298,6 @@ func (h *NotificationHandler) TestNotification(ctx context.Context, input *TestN
}, nil
}
-func (h *NotificationHandler) GetAppriseSettings(ctx context.Context, input *GetAppriseSettingsInput) (*GetAppriseSettingsOutput, error) {
- if err := checkAdminInternal(ctx); err != nil {
- return nil, err
- }
- if err := h.rejectIfAgentModeInternal(); err != nil {
- return nil, err
- }
- settings, err := h.appriseService.GetSettings(ctx)
- if err != nil {
- return nil, huma.Error500InternalServerError("Failed to retrieve Apprise settings", err)
- }
- if settings == nil {
- return nil, huma.Error404NotFound((&common.AppriseSettingsNotFoundError{}).Error())
- }
-
- response := notification.AppriseResponse{
- ID: settings.ID,
- APIURL: settings.APIURL,
- Enabled: settings.Enabled,
- ImageUpdateTag: settings.ImageUpdateTag,
- ContainerUpdateTag: settings.ContainerUpdateTag,
- }
-
- return &GetAppriseSettingsOutput{Body: response}, nil
-}
-
-func (h *NotificationHandler) CreateOrUpdateAppriseSettings(ctx context.Context, input *CreateOrUpdateAppriseSettingsInput) (*CreateOrUpdateAppriseSettingsOutput, error) {
- if err := checkAdminInternal(ctx); err != nil {
- return nil, err
- }
- if err := h.rejectIfAgentModeInternal(); err != nil {
- return nil, err
- }
- if input.Body.Enabled && input.Body.APIURL == "" {
- return nil, huma.Error400BadRequest("API URL is required when Apprise is enabled")
- }
-
- settings, err := h.appriseService.CreateOrUpdateSettings(
- ctx,
- input.Body.APIURL,
- input.Body.Enabled,
- input.Body.ImageUpdateTag,
- input.Body.ContainerUpdateTag,
- )
- if err != nil {
- return nil, huma.Error500InternalServerError((&common.AppriseSettingsUpdateError{Err: err}).Error())
- }
-
- response := notification.AppriseResponse{
- ID: settings.ID,
- APIURL: settings.APIURL,
- Enabled: settings.Enabled,
- ImageUpdateTag: settings.ImageUpdateTag,
- ContainerUpdateTag: settings.ContainerUpdateTag,
- }
-
- return &CreateOrUpdateAppriseSettingsOutput{Body: response}, nil
-}
-
-func (h *NotificationHandler) TestAppriseNotification(ctx context.Context, input *TestAppriseNotificationInput) (*TestAppriseNotificationOutput, error) {
- if err := checkAdminInternal(ctx); err != nil {
- return nil, err
- }
- if err := h.rejectIfAgentModeInternal(); err != nil {
- return nil, err
- }
- testType := normalizeNotificationTestType(input.Type)
- if !isSupportedNotificationTestType(testType) {
- return nil, huma.Error400BadRequest("invalid notification test type")
- }
- target, err := h.notificationService.ResolveNotificationTarget(ctx, input.EnvironmentID)
- if err != nil {
- return nil, huma.Error500InternalServerError((&common.AppriseTestError{Err: err}).Error())
- }
- if err := h.appriseService.TestNotification(ctx, target.EnvironmentName, testType); err != nil {
- return nil, huma.Error500InternalServerError((&common.AppriseTestError{Err: err}).Error())
- }
-
- return &TestAppriseNotificationOutput{
- Body: base.ApiResponse[base.MessageResponse]{
- Success: true,
- Data: base.MessageResponse{Message: "Test notification sent successfully"},
- },
- }, nil
-}
-
func (h *NotificationHandler) DispatchNotification(ctx context.Context, input *DispatchNotificationInput) (*DispatchNotificationOutput, error) {
if err := h.rejectIfAgentModeInternal(); err != nil {
return nil, err
diff --git a/backend/api/handlers/notifications_test.go b/backend/api/handlers/notifications_test.go
index d4c13fdf9..5452a7288 100644
--- a/backend/api/handlers/notifications_test.go
+++ b/backend/api/handlers/notifications_test.go
@@ -23,7 +23,7 @@ func setupNotificationHandlerTestService(t *testing.T) (*database.DB, *services.
db, err := gorm.Open(glsqlite.Open(":memory:"), &gorm.Config{})
require.NoError(t, err)
- require.NoError(t, db.AutoMigrate(&models.NotificationSettings{}, &models.SettingVariable{}, &models.NotificationLog{}, &models.Environment{}, &models.AppriseSettings{}))
+ require.NoError(t, db.AutoMigrate(&models.NotificationSettings{}, &models.SettingVariable{}, &models.NotificationLog{}, &models.Environment{}))
databaseDB := &database.DB{DB: db}
envSvc := services.NewEnvironmentService(databaseDB, nil, nil, nil, nil, nil)
diff --git a/backend/api/handlers/settings.go b/backend/api/handlers/settings.go
index 804792562..47e9c7dcc 100644
--- a/backend/api/handlers/settings.go
+++ b/backend/api/handlers/settings.go
@@ -399,7 +399,7 @@ func (h *SettingsHandler) updateSettingsForLocalEnvironment(ctx context.Context,
func hasAuthSettingsUpdateInternal(req settings.Update) bool {
return req.AuthLocalEnabled != nil || req.OidcEnabled != nil ||
req.AuthSessionTimeout != nil || req.AuthPasswordPolicy != nil ||
- req.AuthOidcConfig != nil || req.OidcClientId != nil ||
+ req.OidcClientId != nil ||
req.OidcClientSecret != nil || req.OidcIssuerUrl != nil ||
req.OidcScopes != nil || req.OidcAdminClaim != nil ||
req.OidcAdminValue != nil || req.OidcMergeAccounts != nil ||
diff --git a/backend/api/handlers/templates.go b/backend/api/handlers/templates.go
index 66d26ed4a..dea6c411a 100644
--- a/backend/api/handlers/templates.go
+++ b/backend/api/handlers/templates.go
@@ -404,7 +404,7 @@ func (h *TemplateHandler) ListTemplates(ctx context.Context, input *ListTemplate
return nil, huma.Error500InternalServerError("service not available")
}
- params := buildPaginationParamsInternal(0, input.Start, input.Limit, input.Sort, input.Order, input.Search)
+ params := buildPaginationParamsInternal(input.Start, input.Limit, input.Sort, input.Order, input.Search)
if params.Limit == 0 {
params.Limit = 20
}
diff --git a/backend/api/handlers/users.go b/backend/api/handlers/users.go
index ca7199aac..ac5c3e582 100644
--- a/backend/api/handlers/users.go
+++ b/backend/api/handlers/users.go
@@ -171,7 +171,7 @@ func (h *UserHandler) ListUsers(ctx context.Context, input *ListUsersInput) (*Li
return nil, err
}
- params := buildPaginationParamsInternal(0, input.Start, input.Limit, input.Sort, input.Order, input.Search)
+ params := buildPaginationParamsInternal(input.Start, input.Limit, input.Sort, input.Order, input.Search)
users, paginationResp, err := h.userService.ListUsersPaginated(ctx, params)
if err != nil {
diff --git a/backend/api/handlers/vulnerabilities.go b/backend/api/handlers/vulnerabilities.go
index 90273f0c8..3d0683c6a 100644
--- a/backend/api/handlers/vulnerabilities.go
+++ b/backend/api/handlers/vulnerabilities.go
@@ -63,8 +63,8 @@ type ListImageVulnerabilitiesInput struct {
Order string `query:"order" doc:"Sort order"`
Start int `query:"start" doc:"Start offset"`
Limit int `query:"limit" doc:"Limit"`
- Page int `query:"page" doc:"Page number"`
- Severity string `query:"severity" doc:"Comma-separated severity filter"`
+
+ Severity string `query:"severity" doc:"Comma-separated severity filter"`
}
type ListImageVulnerabilitiesOutput struct {
@@ -86,9 +86,9 @@ type ListAllVulnerabilitiesInput struct {
Order string `query:"order" doc:"Sort order"`
Start int `query:"start" doc:"Start offset"`
Limit int `query:"limit" doc:"Limit"`
- Page int `query:"page" doc:"Page number"`
- Severity string `query:"severity" doc:"Comma-separated severity filter"`
- ImageName string `query:"imageName" doc:"Filter by image/repo name (substring)"`
+
+ Severity string `query:"severity" doc:"Comma-separated severity filter"`
+ ImageName string `query:"imageName" doc:"Filter by image/repo name (substring)"`
}
type ListAllVulnerabilitiesOutput struct {
@@ -398,7 +398,7 @@ func (h *VulnerabilityHandler) ListImageVulnerabilities(ctx context.Context, inp
return nil, huma.Error500InternalServerError("service not available")
}
- params := buildPaginationParamsInternal(input.Page, input.Start, input.Limit, input.Sort, input.Order, input.Search)
+ params := buildPaginationParamsInternal(input.Start, input.Limit, input.Sort, input.Order, input.Search)
if params.Limit == 0 {
params.Limit = 20
}
@@ -459,7 +459,7 @@ func (h *VulnerabilityHandler) ListAllVulnerabilities(ctx context.Context, input
return nil, huma.Error500InternalServerError("service not available")
}
- params := buildPaginationParamsInternal(input.Page, input.Start, input.Limit, input.Sort, input.Order, input.Search)
+ params := buildPaginationParamsInternal(input.Start, input.Limit, input.Sort, input.Order, input.Search)
if params.Limit == 0 {
params.Limit = 20
}
@@ -628,7 +628,6 @@ type ListIgnoredVulnerabilitiesInput struct {
Order string `query:"order" doc:"Sort order"`
Start int `query:"start" doc:"Start offset"`
Limit int `query:"limit" doc:"Limit"`
- Page int `query:"page" doc:"Page number"`
}
type ListIgnoredVulnerabilitiesOutput struct {
@@ -641,7 +640,7 @@ func (h *VulnerabilityHandler) ListIgnoredVulnerabilities(ctx context.Context, i
return nil, huma.Error500InternalServerError("service not available")
}
- params := buildPaginationParamsInternal(input.Page, input.Start, input.Limit, input.Sort, input.Order, input.Search)
+ params := buildPaginationParamsInternal(input.Start, input.Limit, input.Sort, input.Order, input.Search)
if params.Limit == 0 {
params.Limit = 20
}
diff --git a/backend/internal/bootstrap/bootstrap.go b/backend/internal/bootstrap/bootstrap.go
index 7c9f49241..0e90b377d 100644
--- a/backend/internal/bootstrap/bootstrap.go
+++ b/backend/internal/bootstrap/bootstrap.go
@@ -133,18 +133,7 @@ func initializeStartupState(appCtx context.Context, cfg *config.Config, appServi
AgentMode: cfg.AgentMode,
})
startup.InitializeDefaultSettings(appCtx, runtimeCfg, appServices.Settings)
- startup.MigrateSchedulerCronValues(
- appCtx,
- appServices.Settings.GetStringSetting,
- appServices.Settings.UpdateSetting,
- appServices.Settings.LoadDatabaseSettings,
- )
if appServices.GitOpsSync != nil {
- startup.MigrateGitOpsSyncIntervals(
- appCtx,
- appServices.GitOpsSync.ListSyncIntervalsRaw,
- appServices.GitOpsSync.UpdateSyncIntervalMinutes,
- )
if err := appServices.GitOpsSync.ReconcileDirectorySyncProjectsOnStartup(appCtx); err != nil {
slog.WarnContext(appCtx, "Failed to reconcile directory GitOps projects on startup", "error", err)
}
@@ -205,8 +194,6 @@ func initializeStartupState(appCtx context.Context, cfg *config.Config, appServi
startup.InitializeAutoLogin(ctx, runtimeCfg)
return nil
},
- appServices.Settings.MigrateOidcConfigToFields,
- appServices.Notification.MigrateDiscordWebhookUrlToFields,
)
startup.CleanupUnknownSettings(appCtx, appServices.Settings)
@@ -514,16 +501,6 @@ func normalizeTunnelGRPCRequestPathInternal(r *http.Request) *http.Request {
}
connectMethodPath := tunnelpb.TunnelService_Connect_FullMethodName
- legacyAPIPath := "/api/tunnel/connect"
- if strings.HasSuffix(r.URL.Path, legacyAPIPath) {
- clone := r.Clone(r.Context())
- cloneURL := *clone.URL
- cloneURL.Path = connectMethodPath
- clone.URL = &cloneURL
- clone.RequestURI = connectMethodPath
- return clone
- }
-
idx := strings.Index(r.URL.Path, connectMethodPath)
if idx <= 0 {
return r
@@ -553,7 +530,7 @@ func isTunnelGRPCRequestInternal(r *http.Request) bool {
path := r.URL.Path
fullMethodPath := tunnelpb.TunnelService_Connect_FullMethodName
- if path == fullMethodPath || strings.HasSuffix(path, fullMethodPath) || strings.HasSuffix(path, "/api/tunnel/connect") {
+ if path == fullMethodPath || strings.HasSuffix(path, fullMethodPath) {
return true
}
diff --git a/backend/internal/bootstrap/bootstrap_test.go b/backend/internal/bootstrap/bootstrap_test.go
index 1d883bf21..d92f19a88 100644
--- a/backend/internal/bootstrap/bootstrap_test.go
+++ b/backend/internal/bootstrap/bootstrap_test.go
@@ -43,24 +43,6 @@ func TestNormalizeTunnelGRPCRequestPathInternal(t *testing.T) {
assert.Equal(t, fullMethodPath, normalized.RequestURI)
})
- t.Run("legacy api tunnel path maps to grpc method", func(t *testing.T) {
- req := httptest.NewRequest("POST", "/api/tunnel/connect", nil)
- normalized := normalizeTunnelGRPCRequestPathInternal(req)
-
- assert.NotSame(t, req, normalized)
- assert.Equal(t, fullMethodPath, normalized.URL.Path)
- assert.Equal(t, fullMethodPath, normalized.RequestURI)
- })
-
- t.Run("prefixed legacy api tunnel path maps to grpc method", func(t *testing.T) {
- req := httptest.NewRequest("POST", "/edge/proxy/api/tunnel/connect", nil)
- normalized := normalizeTunnelGRPCRequestPathInternal(req)
-
- assert.NotSame(t, req, normalized)
- assert.Equal(t, fullMethodPath, normalized.URL.Path)
- assert.Equal(t, fullMethodPath, normalized.RequestURI)
- })
-
t.Run("nested proxy prefix is removed up to method path", func(t *testing.T) {
req := httptest.NewRequest("POST", "/edge/proxy/api"+fullMethodPath, nil)
normalized := normalizeTunnelGRPCRequestPathInternal(req)
@@ -91,11 +73,6 @@ func TestIsTunnelGRPCRequestInternal(t *testing.T) {
assert.True(t, isTunnelGRPCRequestInternal(req))
})
- t.Run("detects by legacy tunnel path", func(t *testing.T) {
- req := httptest.NewRequest(http.MethodPost, "/api/tunnel/connect", nil)
- assert.True(t, isTunnelGRPCRequestInternal(req))
- })
-
t.Run("does not match regular api requests", func(t *testing.T) {
req := httptest.NewRequest(http.MethodPost, "/api/environments/pair", nil)
req.Header.Set("Content-Type", "application/json")
diff --git a/backend/internal/bootstrap/router_bootstrap.go b/backend/internal/bootstrap/router_bootstrap.go
index 952e41d0f..265fbfdfc 100644
--- a/backend/internal/bootstrap/router_bootstrap.go
+++ b/backend/internal/bootstrap/router_bootstrap.go
@@ -208,7 +208,6 @@ func setupRouter(ctx context.Context, cfg *config.Config, appServices *Services)
Port: appServices.Port,
Swarm: appServices.Swarm,
Notification: appServices.Notification,
- Apprise: appServices.Apprise,
Updater: appServices.Updater,
CustomizeSearch: appServices.CustomizeSearch,
System: appServices.System,
diff --git a/backend/internal/bootstrap/services_bootstrap.go b/backend/internal/bootstrap/services_bootstrap.go
index 6928ea2d9..ea8c2400b 100644
--- a/backend/internal/bootstrap/services_bootstrap.go
+++ b/backend/internal/bootstrap/services_bootstrap.go
@@ -42,7 +42,6 @@ type Services struct {
Event *services.EventService
Version *services.VersionService
Notification *services.NotificationService
- Apprise *services.AppriseService //nolint:staticcheck // Apprise still functional, deprecated in favor of Shoutrrr
ApiKey *services.ApiKeyService
GitRepository *services.GitRepositoryService
GitOpsSync *services.GitOpsSyncService
@@ -77,7 +76,6 @@ func initializeServices(ctx context.Context, db *database.DB, cfg *config.Config
svcs.Environment = services.NewEnvironmentService(db, httpClient, svcs.Docker, svcs.Event, svcs.Settings, svcs.ApiKey)
svcs.Version = services.NewVersionService(httpClient, cfg.UpdateCheckDisabled, config.Version, config.Revision, svcs.ContainerRegistry, svcs.Docker)
svcs.Notification = services.NewNotificationService(db, cfg, svcs.Environment)
- svcs.Apprise = services.NewAppriseService(db, cfg)
svcs.Vulnerability = services.NewVulnerabilityService(db, svcs.Docker, svcs.Event, svcs.Settings, svcs.Notification)
svcs.ImageUpdate = services.NewImageUpdateService(db, svcs.Settings, svcs.ContainerRegistry, svcs.Docker, svcs.Event, svcs.Notification)
svcs.Image = services.NewImageService(db, svcs.Docker, svcs.ContainerRegistry, svcs.ImageUpdate, svcs.Vulnerability, svcs.Event)
diff --git a/backend/internal/common/errors.go b/backend/internal/common/errors.go
index 1cc554184..8948b037c 100644
--- a/backend/internal/common/errors.go
+++ b/backend/internal/common/errors.go
@@ -423,14 +423,6 @@ func (e *AgentTokenPersistenceError) Error() string {
return "Failed to persist agent token"
}
-type AgentPairingError struct {
- Err error
-}
-
-func (e *AgentPairingError) Error() string {
- return fmt.Sprintf("Agent pairing failed: %v", e.Err)
-}
-
type EnvironmentCreationError struct {
Err error
}
@@ -733,28 +725,6 @@ func (e *NotificationTestError) Error() string {
return fmt.Sprintf("Failed to send test notification: %v", e.Err)
}
-type AppriseSettingsNotFoundError struct{}
-
-func (e *AppriseSettingsNotFoundError) Error() string {
- return "Apprise settings not found"
-}
-
-type AppriseSettingsUpdateError struct {
- Err error
-}
-
-func (e *AppriseSettingsUpdateError) Error() string {
- return fmt.Sprintf("Failed to update Apprise settings: %v", e.Err)
-}
-
-type AppriseTestError struct {
- Err error
-}
-
-func (e *AppriseTestError) Error() string {
- return fmt.Sprintf("Failed to send Apprise test notification: %v", e.Err)
-}
-
type OidcStatusError struct {
Err error
}
diff --git a/backend/internal/configschema/schema.go b/backend/internal/configschema/schema.go
index bdd036d96..095dced73 100644
--- a/backend/internal/configschema/schema.go
+++ b/backend/internal/configschema/schema.go
@@ -91,41 +91,12 @@ type overrideDocRule struct {
}
var overrideDocRules = map[string]overrideDocRule{
- "authOidcConfig": {
- deprecated: true,
- note: "Deprecated legacy JSON OIDC configuration. Prefer the discrete OIDC_* environment variables.",
- },
"autoUpdateInterval": {
requires: "AUTO_UPDATE=true to have effect at runtime.",
},
"scheduledPruneInterval": {
requires: "SCHEDULED_PRUNE_ENABLED=true to have effect at runtime.",
},
- "scheduledPruneContainers": {
- deprecated: true,
- requires: "SCHEDULED_PRUNE_ENABLED=true to have effect at runtime.",
- note: "Legacy boolean prune flag retained for migration compatibility. Prefer PRUNE_CONTAINER_MODE.",
- },
- "scheduledPruneImages": {
- deprecated: true,
- requires: "SCHEDULED_PRUNE_ENABLED=true to have effect at runtime.",
- note: "Legacy boolean prune flag retained for migration compatibility. Prefer PRUNE_IMAGE_MODE.",
- },
- "scheduledPruneVolumes": {
- deprecated: true,
- requires: "SCHEDULED_PRUNE_ENABLED=true to have effect at runtime.",
- note: "Legacy boolean prune flag retained for migration compatibility. Prefer PRUNE_VOLUME_MODE.",
- },
- "scheduledPruneNetworks": {
- deprecated: true,
- requires: "SCHEDULED_PRUNE_ENABLED=true to have effect at runtime.",
- note: "Legacy boolean prune flag retained for migration compatibility. Prefer PRUNE_NETWORK_MODE.",
- },
- "scheduledPruneBuildCache": {
- deprecated: true,
- requires: "SCHEDULED_PRUNE_ENABLED=true to have effect at runtime.",
- note: "Legacy boolean prune flag retained for migration compatibility. Prefer PRUNE_BUILD_CACHE_MODE.",
- },
"pruneContainerMode": {
requires: "SCHEDULED_PRUNE_ENABLED=true to have effect at runtime.",
},
@@ -153,10 +124,6 @@ var overrideDocRules = map[string]overrideDocRule{
"pruneBuildCacheUntil": {
requires: "SCHEDULED_PRUNE_ENABLED=true and PRUNE_BUILD_CACHE_MODE=olderThan to have effect at runtime.",
},
- "dockerPruneMode": {
- deprecated: true,
- note: "Legacy prune mode retained for migration compatibility. Prefer the granular scheduled prune mode settings.",
- },
"vulnerabilityScanInterval": {
requires: "VULNERABILITY_SCAN_ENABLED=true to have effect at runtime.",
},
diff --git a/backend/internal/configschema/schema_test.go b/backend/internal/configschema/schema_test.go
index e2c057487..d45cbedee 100644
--- a/backend/internal/configschema/schema_test.go
+++ b/backend/internal/configschema/schema_test.go
@@ -77,13 +77,6 @@ func TestGenerate_SettingEnvOverridesMatchModelMetadata(t *testing.T) {
assert.Equal(t, "arcane-mobile://oidc-callback", oidcMobileRedirectURIs.DefaultValue)
assert.Equal(t, "authentication", oidcMobileRedirectURIs.Category)
- legacyOIDC, ok := entries["authOidcConfig"]
- require.True(t, ok)
- assert.True(t, legacyOIDC.Deprecated)
- assert.NotEmpty(t, legacyOIDC.Note)
- assert.Contains(t, legacyOIDC.Requires, "AGENT_MODE=true")
- assert.Empty(t, legacyOIDC.DefaultValue)
-
trivyImage, ok := entries["trivyImage"]
require.True(t, ok)
assert.Contains(t, trivyImage.Requires, "UI_CONFIGURATION_DISABLED=true")
@@ -272,7 +265,6 @@ var expectedSettingOverrideKeys = []string{
"accentColor",
"applicationTheme",
"authLocalEnabled",
- "authOidcConfig",
"authPasswordPolicy",
"authSessionTimeout",
"autoHealEnabled",
@@ -345,13 +337,8 @@ var expectedSettingOverrideKeys = []string{
"pruneNetworkUntil",
"pruneVolumeMode",
"registryTimeout",
- "scheduledPruneBuildCache",
- "scheduledPruneContainers",
"scheduledPruneEnabled",
- "scheduledPruneImages",
"scheduledPruneInterval",
- "scheduledPruneNetworks",
- "scheduledPruneVolumes",
"sidebarHoverExpansion",
"swarmStackSourcesDirectory",
"templatesDirectory",
diff --git a/backend/internal/models/notification.go b/backend/internal/models/notification.go
index 9bc6a0e6a..2f9a6f887 100644
--- a/backend/internal/models/notification.go
+++ b/backend/internal/models/notification.go
@@ -209,17 +209,3 @@ type GenericConfig struct {
// checked (existing behaviour).
SuccessBodyContains string `json:"successBodyContains,omitempty"`
}
-
-type AppriseSettings struct {
- ID uint `json:"id" gorm:"primaryKey"`
- APIURL string `json:"apiUrl" gorm:"not null"`
- Enabled bool `json:"enabled" gorm:"default:false"`
- ImageUpdateTag string `json:"imageUpdateTag" gorm:"type:varchar(255)"`
- ContainerUpdateTag string `json:"containerUpdateTag" gorm:"type:varchar(255)"`
- CreatedAt time.Time `json:"createdAt"`
- UpdatedAt time.Time `json:"updatedAt"`
-}
-
-func (AppriseSettings) TableName() string {
- return "apprise_settings"
-}
diff --git a/backend/internal/models/settings.go b/backend/internal/models/settings.go
index f2a98c519..fdd227896 100644
--- a/backend/internal/models/settings.go
+++ b/backend/internal/models/settings.go
@@ -1,7 +1,6 @@
package models
import (
- "encoding/json"
"errors"
"fmt"
"reflect"
@@ -13,8 +12,7 @@ import (
)
const (
- redactionMask = "XXXXXXXXXX"
- keyAuthOidcConfig = "authOidcConfig"
+ redactionMask = "XXXXXXXXXX"
)
type SettingVariable struct {
@@ -92,22 +90,10 @@ type Settings struct {
EventCleanupInterval SettingVariable `key:"eventCleanupInterval" meta:"label=Event Cleanup Interval;type=cron;keywords=events,cleanup,retention,interval,frequency,schedule,history,logs,jobs;description=How often to delete old events (cron expression)"`
ExpiredSessionsCleanupInterval SettingVariable `key:"expiredSessionsCleanupInterval" meta:"label=Expired Sessions Cleanup Interval;type=cron;keywords=sessions,cleanup,retention,expired,revoked,interval,frequency,schedule,auth,jobs;description=How often to delete expired and old revoked sessions (cron expression)"`
AutoInjectEnv SettingVariable `key:"autoInjectEnv" meta:"label=Auto Inject Env Variables;type=boolean;keywords=auto,inject,env,environment,variables,interpolation;category=internal;description=Automatically inject project .env variables into all containers (default: false)"`
- // Deprecated: Use the granular prune mode settings instead.
- PruneMode SettingVariable `key:"dockerPruneMode,internal,deprecated" meta:"label=Legacy Docker Prune Action;type=select;keywords=prune,cleanup,clean,remove,delete,unused,dangling,space,disk,legacy;category=internal;description=Legacy prune mode retained for compatibility and migration"`
- DefaultDeployPullPolicy SettingVariable `key:"defaultDeployPullPolicy" meta:"label=Default Deploy Pull Policy;type=select;keywords=deploy,pull,policy,compose,up,missing,always;category=internal;description=Default image pull policy when deploying projects"`
- ScheduledPruneEnabled SettingVariable `key:"scheduledPruneEnabled" meta:"label=Scheduled Prune Enabled;type=boolean;keywords=prune,cleanup,maintenance,schedule,automatic;category=internal;description=Enable scheduled pruning of unused Docker resources"`
- ScheduledPruneInterval SettingVariable `key:"scheduledPruneInterval" meta:"label=Scheduled Prune Interval;type=cron;keywords=prune,cleanup,interval,minutes,schedule;category=internal;description=How often to run scheduled prunes (cron expression)"`
- GitopsSyncInterval SettingVariable `key:"gitopsSyncInterval" meta:"label=GitOps Sync Interval;type=cron;keywords=gitops,sync,interval,frequency,schedule,repository;category=internal;description=How often to run GitOps synchronization checks (cron expression)"`
- // Deprecated: Use pruneContainerMode instead.
- ScheduledPruneContainers SettingVariable `key:"scheduledPruneContainers,deprecated" meta:"label=Legacy Scheduled Prune Containers;type=boolean;keywords=prune,containers,cleanup,maintenance,legacy;category=internal;description=Legacy boolean container prune flag retained for migration compatibility"`
- // Deprecated: Use pruneImageMode instead.
- ScheduledPruneImages SettingVariable `key:"scheduledPruneImages,deprecated" meta:"label=Legacy Scheduled Prune Images;type=boolean;keywords=prune,images,cleanup,maintenance,legacy;category=internal;description=Legacy boolean image prune flag retained for migration compatibility"`
- // Deprecated: Use pruneVolumeMode instead.
- ScheduledPruneVolumes SettingVariable `key:"scheduledPruneVolumes,deprecated" meta:"label=Legacy Scheduled Prune Volumes;type=boolean;keywords=prune,volumes,cleanup,maintenance,legacy;category=internal;description=Legacy boolean volume prune flag retained for migration compatibility"`
- // Deprecated: Use pruneNetworkMode instead.
- ScheduledPruneNetworks SettingVariable `key:"scheduledPruneNetworks,deprecated" meta:"label=Legacy Scheduled Prune Networks;type=boolean;keywords=prune,networks,cleanup,maintenance,legacy;category=internal;description=Legacy boolean network prune flag retained for migration compatibility"`
- // Deprecated: Use pruneBuildCacheMode instead.
- ScheduledPruneBuildCache SettingVariable `key:"scheduledPruneBuildCache,deprecated" meta:"label=Legacy Scheduled Prune Build Cache;type=boolean;keywords=prune,build cache,cleanup,maintenance,legacy;category=internal;description=Legacy boolean build cache prune flag retained for migration compatibility"`
+ DefaultDeployPullPolicy SettingVariable `key:"defaultDeployPullPolicy" meta:"label=Default Deploy Pull Policy;type=select;keywords=deploy,pull,policy,compose,up,missing,always;category=internal;description=Default image pull policy when deploying projects"`
+ ScheduledPruneEnabled SettingVariable `key:"scheduledPruneEnabled" meta:"label=Scheduled Prune Enabled;type=boolean;keywords=prune,cleanup,maintenance,schedule,automatic;category=internal;description=Enable scheduled pruning of unused Docker resources"`
+ ScheduledPruneInterval SettingVariable `key:"scheduledPruneInterval" meta:"label=Scheduled Prune Interval;type=cron;keywords=prune,cleanup,interval,minutes,schedule;category=internal;description=How often to run scheduled prunes (cron expression)"`
+ GitopsSyncInterval SettingVariable `key:"gitopsSyncInterval" meta:"label=GitOps Sync Interval;type=cron;keywords=gitops,sync,interval,frequency,schedule,repository;category=internal;description=How often to run GitOps synchronization checks (cron expression)"`
PruneContainerMode SettingVariable `key:"pruneContainerMode" meta:"label=Prune Containers;type=select;keywords=prune,containers,cleanup,maintenance,mode,older,stopped;category=internal;description=Select how containers should be pruned when the scheduled prune job runs"`
PruneContainerUntil SettingVariable `key:"pruneContainerUntil" meta:"label=Container Age Filter;type=text;keywords=prune,containers,cleanup,maintenance,until,older,duration;category=internal;description=Duration threshold for scheduled container prune when mode is olderThan"`
PruneImageMode SettingVariable `key:"pruneImageMode" meta:"label=Prune Images;type=select;keywords=prune,images,cleanup,maintenance,mode,dangling,all,older;category=internal;description=Select how images should be pruned when the scheduled prune job runs"`
@@ -151,7 +137,6 @@ type Settings struct {
TrivyConcurrentScanContainers SettingVariable `key:"trivyConcurrentScanContainers,envOverride" meta:"label=Trivy Concurrent Scan Containers;type=number;keywords=trivy,concurrent,scan,containers,parallel,workers,limit,security;category=security;description=Maximum number of concurrent Trivy scan containers for manual and scheduled scans. Minimum 1"`
TrivyConfig SettingVariable `key:"trivyConfig" meta:"label=Trivy Config (YAML);type=textarea;keywords=trivy,config,yaml,configuration,scanner,settings;category=security;description=Trivy configuration file content in YAML format"`
TrivyIgnore SettingVariable `key:"trivyIgnore" meta:"label=.trivyignore;type=textarea;keywords=trivy,ignore,ignorefile,vulnerabilities,exceptions,exclusions;category=security;description=Trivy ignore file content - one vulnerability ID per line"`
- AuthOidcConfig SettingVariable `key:"authOidcConfig,sensitive,deprecated" meta:"label=OIDC Config;type=text;keywords=oidc,config,client,id,issuer,secret,oauth;category=authentication;description=OIDC provider configuration (deprecated - use individual fields)"`
OidcEnabled SettingVariable `key:"oidcEnabled,public,envOverride" meta:"label=OIDC Authentication;type=boolean;keywords=oidc,openid,connect,sso,oauth,external,provider,federation;category=authentication;description=Enable OpenID Connect (OIDC) authentication"`
OidcClientId SettingVariable `key:"oidcClientId,authrequired,envOverride" meta:"label=OIDC Client ID;type=text;keywords=oidc,client,id,oauth,openid;category=authentication;description=OIDC provider client ID"`
OidcClientSecret SettingVariable `key:"oidcClientSecret,sensitive,envOverride" meta:"label=OIDC Client Secret;type=password;keywords=oidc,client,secret,oauth,openid;category=authentication;description=OIDC provider client secret"`
@@ -269,7 +254,7 @@ func (s *Settings) ToSettingVariableSlice(visibility SettingVisibility, redactSe
}
value := cfgValue.Field(field.index).FieldByName("Value").String()
- value = redactSettingValue(field.key, value, field.attrs, redactSensitiveValues)
+ value = redactSettingValue(value, field.attrs, redactSensitiveValues)
settingVariable := SettingVariable{
Key: field.key,
@@ -340,23 +325,11 @@ func (s *Settings) UpdateField(key string, value string, noSensitive bool) error
}
// helper keeps redaction logic in one place; behavior unchanged
-func redactSettingValue(key, value, attrs string, redact bool) string {
+func redactSettingValue(value, attrs string, redact bool) string {
if value == "" || !redact || !strings.Contains(attrs, "sensitive") {
return value
}
- if key == keyAuthOidcConfig {
- var cfg OidcConfig
- if err := json.Unmarshal([]byte(value), &cfg); err == nil {
- cfg.ClientSecret = ""
- if redacted, err := cfg.MarshalDocument(); err == nil {
- return string(redacted)
- }
- return redactionMask
- }
- return redactionMask
- }
-
return redactionMask
}
@@ -408,34 +381,3 @@ type OidcConfig struct {
SkipTlsVerify bool `json:"skipTlsVerify"`
}
-
-// MarshalDocument preserves the legacy json.Marshal(OidcConfig) document shape,
-// including omitempty behavior for optional string fields, while avoiding gosec
-// false positives on the clientSecret field.
-func (c OidcConfig) MarshalDocument() ([]byte, error) {
- doc := map[string]any{
- "clientId": c.ClientID,
- "clientSecret": c.ClientSecret,
- "issuerUrl": c.IssuerURL,
- "scopes": c.Scopes,
- "skipTlsVerify": c.SkipTlsVerify,
- }
-
- addOptionalStringFieldInternal(doc, "authorizationEndpoint", c.AuthorizationEndpoint)
- addOptionalStringFieldInternal(doc, "tokenEndpoint", c.TokenEndpoint)
- addOptionalStringFieldInternal(doc, "userinfoEndpoint", c.UserinfoEndpoint)
- addOptionalStringFieldInternal(doc, "jwksUri", c.JwksURI)
- addOptionalStringFieldInternal(doc, "deviceAuthorizationEndpoint", c.DeviceAuthorizationEndpoint)
- addOptionalStringFieldInternal(doc, "adminClaim", c.AdminClaim)
- addOptionalStringFieldInternal(doc, "adminValue", c.AdminValue)
-
- return json.Marshal(doc)
-}
-
-func addOptionalStringFieldInternal(doc map[string]any, key, value string) {
- if value == "" {
- return
- }
-
- doc[key] = value
-}
diff --git a/backend/internal/models/settings_test.go b/backend/internal/models/settings_test.go
index 156ce15c9..97e214ae2 100644
--- a/backend/internal/models/settings_test.go
+++ b/backend/internal/models/settings_test.go
@@ -1,48 +1,11 @@
package models
import (
- "encoding/json"
"testing"
"github.com/stretchr/testify/require"
)
-func TestOidcConfig_MarshalDocument_PreservesOmitemptySemantics(t *testing.T) {
- config := OidcConfig{
- ClientID: "client-id",
- ClientSecret: "client-secret",
- IssuerURL: "https://issuer.example",
- Scopes: "openid email profile",
- AuthorizationEndpoint: "",
- TokenEndpoint: "https://issuer.example/token",
- UserinfoEndpoint: "",
- JwksURI: "https://issuer.example/jwks",
- AdminClaim: "",
- AdminValue: "admins",
- SkipTlsVerify: true,
- }
-
- data, err := config.MarshalDocument()
- require.NoError(t, err)
-
- var doc map[string]any
- require.NoError(t, json.Unmarshal(data, &doc))
-
- require.Equal(t, "client-id", doc["clientId"])
- require.Equal(t, "client-secret", doc["clientSecret"])
- require.Equal(t, "https://issuer.example", doc["issuerUrl"])
- require.Equal(t, "openid email profile", doc["scopes"])
- require.Equal(t, true, doc["skipTlsVerify"])
-
- require.NotContains(t, doc, "authorizationEndpoint")
- require.NotContains(t, doc, "userinfoEndpoint")
- require.NotContains(t, doc, "adminClaim")
-
- require.Equal(t, "https://issuer.example/token", doc["tokenEndpoint"])
- require.Equal(t, "https://issuer.example/jwks", doc["jwksUri"])
- require.Equal(t, "admins", doc["adminValue"])
-}
-
func TestSettings_ToSettingVariableSlice_Visibility(t *testing.T) {
settings := &Settings{
ApplicationTheme: SettingVariable{Value: "default"},
diff --git a/backend/internal/services/apprise_service.go b/backend/internal/services/apprise_service.go
deleted file mode 100644
index 6cf858e08..000000000
--- a/backend/internal/services/apprise_service.go
+++ /dev/null
@@ -1,255 +0,0 @@
-package services
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "log/slog"
- "net/http"
- "time"
-
- "github.com/getarcaneapp/arcane/backend/internal/config"
- "github.com/getarcaneapp/arcane/backend/internal/database"
- "github.com/getarcaneapp/arcane/backend/internal/models"
- "github.com/getarcaneapp/arcane/backend/pkg/utils/notifications"
- "github.com/getarcaneapp/arcane/types/imageupdate"
- "gorm.io/gorm"
-)
-
-// AppriseService handles sending notifications through Apprise API
-//
-// Deprecated: Built-in providers (e.g., SMTP via Shoutrrr) are preferred.
-type AppriseService struct {
- db *database.DB
- config *config.Config
-}
-
-func NewAppriseService(db *database.DB, cfg *config.Config) *AppriseService {
- return &AppriseService{
- db: db,
- config: cfg,
- }
-}
-
-type AppriseNotificationPayload struct {
- Body string `json:"body"`
- Title string `json:"title,omitempty"`
- Type string `json:"type,omitempty"`
- Tag []string `json:"tag,omitempty"`
- Format string `json:"format,omitempty"`
-}
-
-func (s *AppriseService) GetSettings(ctx context.Context) (*models.AppriseSettings, error) {
- var settings models.AppriseSettings
- if err := s.db.WithContext(ctx).First(&settings).Error; err != nil {
- if errors.Is(err, gorm.ErrRecordNotFound) {
- return nil, nil
- }
- return nil, err
- }
- return &settings, nil
-}
-
-func (s *AppriseService) CreateOrUpdateSettings(ctx context.Context, apiURL string, enabled bool, imageUpdateTag, containerUpdateTag string) (*models.AppriseSettings, error) {
- var settings models.AppriseSettings
-
- err := s.db.WithContext(ctx).First(&settings).Error
- if err != nil {
- if !errors.Is(err, gorm.ErrRecordNotFound) {
- return nil, fmt.Errorf("failed to check apprise settings: %w", err)
- }
- settings = models.AppriseSettings{
- APIURL: apiURL,
- Enabled: enabled,
- ImageUpdateTag: imageUpdateTag,
- ContainerUpdateTag: containerUpdateTag,
- }
- if err := s.db.WithContext(ctx).Create(&settings).Error; err != nil {
- return nil, fmt.Errorf("failed to create apprise settings: %w", err)
- }
- } else {
- settings.APIURL = apiURL
- settings.Enabled = enabled
- settings.ImageUpdateTag = imageUpdateTag
- settings.ContainerUpdateTag = containerUpdateTag
- if err := s.db.WithContext(ctx).Save(&settings).Error; err != nil {
- return nil, fmt.Errorf("failed to update apprise settings: %w", err)
- }
- }
-
- return &settings, nil
-}
-
-func (s *AppriseService) SendNotification(ctx context.Context, title, body, format string, notificationType models.NotificationEventType) error {
- settings, err := s.GetSettings(ctx)
- if err != nil {
- return fmt.Errorf("failed to get apprise settings: %w", err)
- }
-
- if settings == nil || !settings.Enabled {
- return nil
- }
-
- if settings.APIURL == "" {
- return fmt.Errorf("apprise API URL not configured")
- }
-
- var tags []string
- switch notificationType {
- case models.NotificationEventImageUpdate:
- if settings.ImageUpdateTag != "" {
- tags = []string{settings.ImageUpdateTag}
- }
- case models.NotificationEventContainerUpdate:
- if settings.ContainerUpdateTag != "" {
- tags = []string{settings.ContainerUpdateTag}
- }
-
- case models.NotificationEventPruneReport:
- // Handle tags for prune report if needed, or leave empty
-
- case models.NotificationEventVulnerabilityFound:
- // No dedicated tag in AppriseSettings; notification is sent without a tag
-
- case models.NotificationEventAutoHeal:
- // No dedicated tag in AppriseSettings; notification is sent without a tag
- }
-
- payload := AppriseNotificationPayload{
- Title: title,
- Body: body,
- Type: "info",
- Tag: tags,
- Format: format,
- }
-
- jsonData, err := json.Marshal(payload)
- if err != nil {
- return fmt.Errorf("failed to marshal notification payload: %w", err)
- }
-
- slog.InfoContext(ctx, "Sending Apprise notification", "url", settings.APIURL, "title", title, "tags", tags, "type", string(notificationType))
-
- req, err := http.NewRequestWithContext(ctx, http.MethodPost, settings.APIURL, bytes.NewBuffer(jsonData))
- if err != nil {
- return fmt.Errorf("failed to create request: %w", err)
- }
- req.Header.Set("Content-Type", "application/json")
-
- client := &http.Client{Timeout: 10 * time.Second}
- resp, err := client.Do(req) //nolint:gosec // intentional request to user-configured Apprise API endpoint
- if err != nil {
- return fmt.Errorf("failed to send notification: %w", err)
- }
- defer func() { _ = resp.Body.Close() }()
-
- // Read response body for debugging
- bodyBytes, _ := io.ReadAll(resp.Body)
- bodyString := string(bodyBytes)
-
- if resp.StatusCode != http.StatusOK {
- slog.ErrorContext(ctx, "Apprise API returned error", "status", resp.StatusCode, "response", bodyString, "url", settings.APIURL)
- return fmt.Errorf("apprise API returned status %d: %s", resp.StatusCode, bodyString)
- }
-
- slog.InfoContext(ctx, "Apprise notification sent successfully", "status", resp.StatusCode, "response", bodyString)
-
- return nil
-}
-
-func (s *AppriseService) SendImageUpdateNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response) error {
- title := fmt.Sprintf("[%s] Container Image Update Available: %s", environmentName, imageRef)
- body := notifications.BuildImageUpdateNotificationMessage(notifications.MessageFormatPlain, environmentName, imageRef, updateInfo)
- return s.SendNotification(ctx, title, body, "text", models.NotificationEventImageUpdate)
-}
-
-func (s *AppriseService) SendContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string) error {
- title := fmt.Sprintf("[%s] Container Updated: %s", environmentName, containerName)
- body := notifications.BuildContainerUpdateNotificationMessage(notifications.MessageFormatPlain, environmentName, containerName, imageRef, oldDigest, newDigest)
- return s.SendNotification(ctx, title, body, "text", models.NotificationEventContainerUpdate)
-}
-
-func (s *AppriseService) SendBatchImageUpdateNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response) error {
- if len(updates) == 0 {
- return nil
- }
-
- updatesWithChanges := make(map[string]*imageupdate.Response)
- for imageRef, update := range updates {
- if update != nil && update.HasUpdate {
- updatesWithChanges[imageRef] = update
- }
- }
-
- if len(updatesWithChanges) == 0 {
- return nil
- }
-
- title := fmt.Sprintf("[%s] %d Container Image Update(s) Available", environmentName, len(updatesWithChanges))
- body := notifications.BuildBatchImageUpdateNotificationMessage(notifications.MessageFormatPlain, environmentName, updatesWithChanges)
-
- return s.SendNotification(ctx, title, body, "text", models.NotificationEventImageUpdate)
-}
-
-func (s *AppriseService) TestNotification(ctx context.Context, environmentName, testType string) error {
- switch testType {
- case "vulnerability-found":
- title := notifications.BuildEmailSubject(environmentName, "Vulnerability Summary Notification")
- body := fmt.Sprintf(
- "Summary Date: %s\nCritical: 1\nHigh: 3\nMedium: 2\nLow: 1\nUnknown: 0\nFixable vulnerabilities: 7\nExamples: CVE-2025-1234, CVE-2025-5678, CVE-2026-0001",
- time.Now().UTC().Format("2006-01-02"),
- )
- return s.SendNotification(ctx, title, body, "text", models.NotificationEventVulnerabilityFound)
- case "prune-report":
- title := notifications.BuildEmailSubject(environmentName, "System Prune Report")
- body := "Containers pruned: 2\nImages deleted: 1\nVolumes deleted: 1\nNetworks deleted: 1\nSpace reclaimed: 3.56 GB"
- return s.SendNotification(ctx, title, body, "text", models.NotificationEventPruneReport)
- case "image-update":
- testUpdate := &imageupdate.Response{
- HasUpdate: true,
- UpdateType: "digest",
- CurrentDigest: "sha256:abc123def456789012345678901234567890",
- LatestDigest: "sha256:xyz789ghi012345678901234567890123456",
- CheckTime: time.Now(),
- ResponseTimeMs: 100,
- }
- return s.SendImageUpdateNotification(ctx, environmentName, "nginx:latest", testUpdate)
- case "batch-image-update":
- testUpdates := map[string]*imageupdate.Response{
- "nginx:latest": {
- HasUpdate: true,
- UpdateType: "digest",
- CurrentDigest: "sha256:abc123def456789012345678901234567890",
- LatestDigest: "sha256:xyz789ghi012345678901234567890123456",
- CheckTime: time.Now(),
- ResponseTimeMs: 100,
- },
- "postgres:16-alpine": {
- HasUpdate: true,
- UpdateType: "digest",
- CurrentDigest: "sha256:def456abc123789012345678901234567890",
- LatestDigest: "sha256:ghi789xyz012345678901234567890123456",
- CheckTime: time.Now(),
- ResponseTimeMs: 120,
- },
- "redis:7.2-alpine": {
- HasUpdate: true,
- UpdateType: "digest",
- CurrentDigest: "sha256:123456789abc012345678901234567890def",
- LatestDigest: "sha256:456789012def345678901234567890123abc",
- CheckTime: time.Now(),
- ResponseTimeMs: 95,
- },
- }
- return s.SendBatchImageUpdateNotification(ctx, environmentName, testUpdates)
- case "simple", "":
- title := notifications.BuildEmailSubject(environmentName, "Test Notification from Arcane")
- body := "If you're reading this, your Apprise integration is working correctly!"
- return s.SendNotification(ctx, title, body, "text", models.NotificationEventImageUpdate)
- default:
- return fmt.Errorf("unsupported apprise test type: %s", testType)
- }
-}
diff --git a/backend/internal/services/environment_service.go b/backend/internal/services/environment_service.go
index 312acf0d1..df226c2bc 100644
--- a/backend/internal/services/environment_service.go
+++ b/backend/internal/services/environment_service.go
@@ -5,7 +5,6 @@ import (
"encoding/json"
"errors"
"fmt"
- "io"
"log/slog"
"net/http"
"strings"
@@ -971,64 +970,6 @@ func (s *EnvironmentService) RegenerateEnvironmentApiKey(ctx context.Context, en
return nil
}
-// Deprecated - Use the Api Key flow
-func (s *EnvironmentService) PairAgentWithBootstrap(ctx context.Context, apiUrl, bootstrapToken string) (string, error) {
- pairURL, err := buildEnvironmentEndpointURLInternal(apiUrl, "/api/environments/0/agent/pair")
- if err != nil {
- return "", fmt.Errorf("invalid agent API URL: %w", err)
- }
-
- reqCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
- defer cancel()
- req, err := http.NewRequestWithContext(reqCtx, http.MethodPost, pairURL, nil)
- if err != nil {
- return "", fmt.Errorf("create request: %w", err)
- }
- req.Header.Set("X-Arcane-Agent-Bootstrap", bootstrapToken)
-
- resp, err := s.httpClient.Do(req) //nolint:gosec // intentional request to configured remote environment API URL
- if err != nil {
- return "", fmt.Errorf("request failed: %w", err)
- }
- defer func() { _ = resp.Body.Close() }()
-
- if resp.StatusCode != http.StatusOK {
- body, _ := io.ReadAll(resp.Body)
- return "", fmt.Errorf("unexpected status %d: %s", resp.StatusCode, string(body))
- }
-
- var parsed struct {
- Success bool `json:"success"`
- Data struct {
- Token string `json:"token"`
- } `json:"data"`
- Message string `json:"message"`
- }
- if err := json.NewDecoder(resp.Body).Decode(&parsed); err != nil {
- return "", fmt.Errorf("decode response: %w", err)
- }
- if !parsed.Success || parsed.Data.Token == "" {
- return "", fmt.Errorf("pairing unsuccessful")
- }
-
- return parsed.Data.Token, nil
-}
-
-func (s *EnvironmentService) PairAndPersistAgentToken(ctx context.Context, environmentID, apiUrl, bootstrapToken string) (string, error) {
- token, err := s.PairAgentWithBootstrap(ctx, apiUrl, bootstrapToken)
- if err != nil {
- return "", err
- }
- if err := s.db.WithContext(ctx).
- Model(&models.Environment{}).
- Where("id = ?", environmentID).
- Update("access_token", token).Error; err != nil {
- return "", fmt.Errorf("failed to persist agent token: %w", err)
- }
- s.syncEnvironmentTokenCacheInternal(environmentID, token)
- return token, nil
-}
-
func (s *EnvironmentService) GetDB() *database.DB {
return s.db
}
diff --git a/backend/internal/services/environment_service_test.go b/backend/internal/services/environment_service_test.go
index 4ad417464..0c7d3ac1c 100644
--- a/backend/internal/services/environment_service_test.go
+++ b/backend/internal/services/environment_service_test.go
@@ -929,14 +929,6 @@ func TestEnvironmentService_GenerateEdgeDeploymentSnippets_ReturnsBasicSnippetsW
require.Contains(t, snippets.DockerCompose, "MANAGER_API_URL=https://manager.example.com")
}
-func TestEnvironmentService_PairAgentWithBootstrap_RejectsInvalidURL(t *testing.T) {
- svc := NewEnvironmentService(nil, nil, nil, nil, nil, nil)
-
- _, err := svc.PairAgentWithBootstrap(context.Background(), "ftp://example.com", "bootstrap-token")
- require.Error(t, err)
- require.Contains(t, err.Error(), "invalid agent API URL")
-}
-
func TestEnvironmentService_TestConnection_RejectsInvalidCustomURL(t *testing.T) {
ctx := context.Background()
db := setupEnvironmentServiceTestDB(t)
diff --git a/backend/internal/services/gitops_sync_service.go b/backend/internal/services/gitops_sync_service.go
index 860cdcde0..2fe0df9a5 100644
--- a/backend/internal/services/gitops_sync_service.go
+++ b/backend/internal/services/gitops_sync_service.go
@@ -15,7 +15,6 @@ import (
"github.com/getarcaneapp/arcane/backend/internal/common"
"github.com/getarcaneapp/arcane/backend/internal/database"
"github.com/getarcaneapp/arcane/backend/internal/models"
- "github.com/getarcaneapp/arcane/backend/pkg/libarcane/startup"
"github.com/getarcaneapp/arcane/backend/pkg/pagination"
"github.com/getarcaneapp/arcane/backend/pkg/projects"
"github.com/getarcaneapp/arcane/backend/pkg/utils"
@@ -147,42 +146,6 @@ func (s *GitOpsSyncService) gitSyncLimitEnvOverrideActiveInternal(key string) bo
return s.settingsService != nil && s.settingsService.isEnvOverrideActiveInternal(key)
}
-func (s *GitOpsSyncService) ListSyncIntervalsRaw(ctx context.Context) ([]startup.IntervalMigrationItem, error) {
- rows, err := s.db.WithContext(ctx).Raw("SELECT id, sync_interval FROM gitops_syncs").Rows()
- if err != nil {
- return nil, fmt.Errorf("failed to load git sync intervals: %w", err)
- }
- defer func() { _ = rows.Close() }()
-
- items := make([]startup.IntervalMigrationItem, 0)
- for rows.Next() {
- var id string
- var raw any
- if err := rows.Scan(&id, &raw); err != nil {
- return nil, fmt.Errorf("failed to scan git sync interval: %w", err)
- }
- items = append(items, startup.IntervalMigrationItem{
- ID: id,
- RawValue: strings.TrimSpace(fmt.Sprint(raw)),
- })
- }
- if err := rows.Err(); err != nil {
- return nil, fmt.Errorf("failed to read git sync intervals: %w", err)
- }
-
- return items, nil
-}
-
-func (s *GitOpsSyncService) UpdateSyncIntervalMinutes(ctx context.Context, id string, minutes int) error {
- if minutes <= 0 {
- return fmt.Errorf("sync interval must be positive")
- }
- return s.db.WithContext(ctx).
- Model(&models.GitOpsSync{}).
- Where("id = ?", id).
- Update("sync_interval", minutes).Error
-}
-
func (s *GitOpsSyncService) GetSyncsPaginated(ctx context.Context, environmentID string, params pagination.QueryParams) ([]gitops.GitOpsSync, pagination.Response, gitops.SyncCounts, error) {
var syncs []models.GitOpsSync
q := s.db.WithContext(ctx).Model(&models.GitOpsSync{}).
diff --git a/backend/internal/services/notification_service.go b/backend/internal/services/notification_service.go
index 4ef266e21..df29bb8d9 100644
--- a/backend/internal/services/notification_service.go
+++ b/backend/internal/services/notification_service.go
@@ -14,8 +14,6 @@ import (
"text/template"
"time"
- "gorm.io/gorm"
-
"github.com/getarcaneapp/arcane/backend/internal/config"
"github.com/getarcaneapp/arcane/backend/internal/database"
"github.com/getarcaneapp/arcane/backend/internal/models"
@@ -66,7 +64,6 @@ type NotificationService struct {
db *database.DB
config *config.Config
environmentSvc *EnvironmentService
- appriseService *AppriseService
httpClient *http.Client
}
@@ -93,7 +90,6 @@ func NewNotificationService(db *database.DB, cfg *config.Config, environmentSvc
db: db,
config: cfg,
environmentSvc: environmentSvc,
- appriseService: NewAppriseService(db, cfg),
httpClient: &http.Client{Timeout: 15 * time.Second},
}
}
@@ -325,11 +321,6 @@ func (s *NotificationService) SendImageUpdateNotification(ctx context.Context, i
}
func (s *NotificationService) sendImageUpdateNotificationForTargetInternal(ctx context.Context, target NotificationTarget, imageRef string, updateInfo *imageupdate.Response, eventType models.NotificationEventType) error {
- // Send to Apprise if enabled (don't block on error)
- if appriseErr := s.appriseService.SendImageUpdateNotification(ctx, target.EnvironmentName, imageRef, updateInfo); appriseErr != nil {
- slog.WarnContext(ctx, "Failed to send Apprise notification", "error", appriseErr)
- }
-
settings, err := s.GetAllSettings(ctx)
if err != nil {
return fmt.Errorf("failed to get notification settings: %w", err)
@@ -445,11 +436,6 @@ func (s *NotificationService) SendContainerUpdateNotification(ctx context.Contex
}
func (s *NotificationService) sendContainerUpdateNotificationForTargetInternal(ctx context.Context, target NotificationTarget, containerName, imageRef, oldDigest, newDigest string) error {
- // Send to Apprise if enabled (don't block on error)
- if appriseErr := s.appriseService.SendContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest); appriseErr != nil {
- slog.WarnContext(ctx, "Failed to send Apprise notification", "error", appriseErr)
- }
-
settings, err := s.GetAllSettings(ctx)
if err != nil {
return fmt.Errorf("failed to get notification settings: %w", err)
@@ -633,11 +619,11 @@ func (s *NotificationService) sendDiscordNotification(ctx context.Context, envir
// Decrypt token if encrypted
if discordConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(discordConfig.Token); err == nil {
- discordConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Discord token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(discordConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ discordConfig.Token = decrypted
}
message := notifications.BuildImageUpdateNotificationMessage(
@@ -673,11 +659,11 @@ func (s *NotificationService) sendTelegramNotification(ctx context.Context, envi
// Decrypt bot token if encrypted
if telegramConfig.BotToken != "" {
- if decrypted, err := crypto.Decrypt(telegramConfig.BotToken); err == nil {
- telegramConfig.BotToken = decrypted
- } else {
- slog.Warn("Failed to decrypt Telegram bot token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(telegramConfig.BotToken)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ telegramConfig.BotToken = decrypted
}
message := notifications.BuildImageUpdateNotificationMessage(
@@ -726,11 +712,11 @@ func (s *NotificationService) sendEmailNotification(ctx context.Context, environ
}
if emailConfig.SMTPPassword != "" {
- if decrypted, err := crypto.Decrypt(emailConfig.SMTPPassword); err == nil {
- emailConfig.SMTPPassword = decrypted
- } else {
- slog.Warn("Failed to decrypt email SMTP password, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(emailConfig.SMTPPassword)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ emailConfig.SMTPPassword = decrypted
}
htmlBody, _, err := s.renderEmailTemplate(environmentName, imageRef, updateInfo)
@@ -810,11 +796,11 @@ func (s *NotificationService) sendDiscordContainerUpdateNotification(ctx context
// Decrypt token if encrypted
if discordConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(discordConfig.Token); err == nil {
- discordConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Discord token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(discordConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ discordConfig.Token = decrypted
}
message := notifications.BuildContainerUpdateNotificationMessage(
@@ -852,11 +838,11 @@ func (s *NotificationService) sendTelegramContainerUpdateNotification(ctx contex
// Decrypt bot token if encrypted
if telegramConfig.BotToken != "" {
- if decrypted, err := crypto.Decrypt(telegramConfig.BotToken); err == nil {
- telegramConfig.BotToken = decrypted
- } else {
- slog.Warn("Failed to decrypt Telegram bot token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(telegramConfig.BotToken)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ telegramConfig.BotToken = decrypted
}
message := notifications.BuildContainerUpdateNotificationMessage(
@@ -907,11 +893,11 @@ func (s *NotificationService) sendEmailContainerUpdateNotification(ctx context.C
}
if emailConfig.SMTPPassword != "" {
- if decrypted, err := crypto.Decrypt(emailConfig.SMTPPassword); err == nil {
- emailConfig.SMTPPassword = decrypted
- } else {
- slog.Warn("Failed to decrypt email SMTP password, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(emailConfig.SMTPPassword)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ emailConfig.SMTPPassword = decrypted
}
htmlBody, _, err := s.renderContainerUpdateEmailTemplate(environmentName, containerName, imageRef, oldDigest, newDigest)
@@ -1220,9 +1206,11 @@ func (s *NotificationService) sendTestEmail(ctx context.Context, environmentName
}
if emailConfig.SMTPPassword != "" {
- if decrypted, err := crypto.Decrypt(emailConfig.SMTPPassword); err == nil {
- emailConfig.SMTPPassword = decrypted
+ decrypted, err := crypto.Decrypt(emailConfig.SMTPPassword)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ emailConfig.SMTPPassword = decrypted
}
htmlBody, _, err := s.renderTestEmailTemplate(environmentName)
@@ -1335,11 +1323,6 @@ func (s *NotificationService) sendBatchImageUpdateNotificationForTargetInternal(
return nil
}
- // Send to Apprise if enabled
- if appriseErr := s.appriseService.SendBatchImageUpdateNotification(ctx, target.EnvironmentName, updatesWithChanges); appriseErr != nil {
- slog.WarnContext(ctx, "Failed to send Apprise notification", "error", appriseErr)
- }
-
settings, err := s.GetAllSettings(ctx)
if err != nil {
return fmt.Errorf("failed to get notification settings: %w", err)
@@ -1420,8 +1403,12 @@ func (s *NotificationService) sendBatchDiscordNotification(ctx context.Context,
return fmt.Errorf("failed to unmarshal discord config: %w", err)
}
- // Decrypt token if encrypted
- if decrypted, err := crypto.Decrypt(discordConfig.Token); err == nil {
+ // Decrypt token
+ if discordConfig.Token != "" {
+ decrypted, err := crypto.Decrypt(discordConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
+ }
discordConfig.Token = decrypted
}
@@ -1448,8 +1435,12 @@ func (s *NotificationService) sendBatchTelegramNotification(ctx context.Context,
return fmt.Errorf("failed to unmarshal telegram config: %w", err)
}
- // Decrypt bot token if encrypted
- if decrypted, err := crypto.Decrypt(telegramConfig.BotToken); err == nil {
+ // Decrypt bot token
+ if telegramConfig.BotToken != "" {
+ decrypted, err := crypto.Decrypt(telegramConfig.BotToken)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
+ }
telegramConfig.BotToken = decrypted
}
@@ -1498,11 +1489,11 @@ func (s *NotificationService) sendBatchEmailNotification(ctx context.Context, en
}
if emailConfig.SMTPPassword != "" {
- if decrypted, err := crypto.Decrypt(emailConfig.SMTPPassword); err == nil {
- emailConfig.SMTPPassword = decrypted
- } else {
- slog.Warn("Failed to decrypt email SMTP password, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(emailConfig.SMTPPassword)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ emailConfig.SMTPPassword = decrypted
}
htmlBody, _, err := s.renderBatchEmailTemplate(environmentName, updates)
@@ -1610,18 +1601,18 @@ func (s *NotificationService) sendSignalNotification(ctx context.Context, enviro
// Decrypt sensitive fields if encrypted
if signalConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(signalConfig.Password); err == nil {
- signalConfig.Password = decrypted
- } else {
- slog.Warn("Failed to decrypt Signal password, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(signalConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ signalConfig.Password = decrypted
}
if signalConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(signalConfig.Token); err == nil {
- signalConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Signal token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(signalConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ signalConfig.Token = decrypted
}
message := notifications.BuildImageUpdateNotificationMessage(
@@ -1673,18 +1664,18 @@ func (s *NotificationService) sendSignalContainerUpdateNotification(ctx context.
// Decrypt sensitive fields if encrypted
if signalConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(signalConfig.Password); err == nil {
- signalConfig.Password = decrypted
- } else {
- slog.Warn("Failed to decrypt Signal password, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(signalConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ signalConfig.Password = decrypted
}
if signalConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(signalConfig.Token); err == nil {
- signalConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Signal token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(signalConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ signalConfig.Token = decrypted
}
message := notifications.BuildContainerUpdateNotificationMessage(
@@ -1725,14 +1716,18 @@ func (s *NotificationService) sendBatchSignalNotification(ctx context.Context, e
// Decrypt sensitive fields if encrypted
if signalConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(signalConfig.Password); err == nil {
- signalConfig.Password = decrypted
+ decrypted, err := crypto.Decrypt(signalConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ signalConfig.Password = decrypted
}
if signalConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(signalConfig.Token); err == nil {
- signalConfig.Token = decrypted
+ decrypted, err := crypto.Decrypt(signalConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ signalConfig.Token = decrypted
}
message := notifications.BuildBatchImageUpdateNotificationMessage(
@@ -1764,11 +1759,11 @@ func (s *NotificationService) sendSlackNotification(ctx context.Context, environ
// Decrypt token if encrypted
if slackConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(slackConfig.Token); err == nil {
- slackConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Slack token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(slackConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ slackConfig.Token = decrypted
}
message := notifications.BuildImageUpdateNotificationMessage(
@@ -1801,11 +1796,11 @@ func (s *NotificationService) sendSlackContainerUpdateNotification(ctx context.C
// Decrypt token if encrypted
if slackConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(slackConfig.Token); err == nil {
- slackConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Slack token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(slackConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ slackConfig.Token = decrypted
}
message := notifications.BuildContainerUpdateNotificationMessage(
@@ -1834,8 +1829,12 @@ func (s *NotificationService) sendBatchSlackNotification(ctx context.Context, en
return fmt.Errorf("failed to unmarshal slack config: %w", err)
}
- // Decrypt token if encrypted
- if decrypted, err := crypto.Decrypt(slackConfig.Token); err == nil {
+ // Decrypt token
+ if slackConfig.Token != "" {
+ decrypted, err := crypto.Decrypt(slackConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
+ }
slackConfig.Token = decrypted
}
@@ -1868,11 +1867,11 @@ func (s *NotificationService) sendNtfyNotification(ctx context.Context, environm
// Decrypt password if encrypted
if ntfyConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(ntfyConfig.Password); err == nil {
- ntfyConfig.Password = decrypted
- } else {
- slog.Warn("Failed to decrypt Ntfy password, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(ntfyConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ ntfyConfig.Password = decrypted
}
message := notifications.BuildImageUpdateNotificationMessage(
@@ -1905,11 +1904,11 @@ func (s *NotificationService) sendNtfyContainerUpdateNotification(ctx context.Co
// Decrypt password if encrypted
if ntfyConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(ntfyConfig.Password); err == nil {
- ntfyConfig.Password = decrypted
- } else {
- slog.Warn("Failed to decrypt Ntfy password, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(ntfyConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ ntfyConfig.Password = decrypted
}
message := notifications.BuildContainerUpdateNotificationMessage(
@@ -1940,9 +1939,11 @@ func (s *NotificationService) sendBatchNtfyNotification(ctx context.Context, env
// Decrypt password if encrypted
if ntfyConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(ntfyConfig.Password); err == nil {
- ntfyConfig.Password = decrypted
+ decrypted, err := crypto.Decrypt(ntfyConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ ntfyConfig.Password = decrypted
}
message := notifications.BuildBatchImageUpdateNotificationMessage(
@@ -1976,11 +1977,11 @@ func (s *NotificationService) sendPushoverNotification(ctx context.Context, envi
}
if pushoverConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(pushoverConfig.Token); err == nil {
- pushoverConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Pushover token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(pushoverConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ pushoverConfig.Token = decrypted
}
message := notifications.BuildImageUpdateNotificationMessage(
@@ -2015,11 +2016,11 @@ func (s *NotificationService) sendPushoverContainerUpdateNotification(ctx contex
}
if pushoverConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(pushoverConfig.Token); err == nil {
- pushoverConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Pushover token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(pushoverConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ pushoverConfig.Token = decrypted
}
message := notifications.BuildContainerUpdateNotificationMessage(
@@ -2049,9 +2050,11 @@ func (s *NotificationService) sendBatchPushoverNotification(ctx context.Context,
}
if pushoverConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(pushoverConfig.Token); err == nil {
- pushoverConfig.Token = decrypted
+ decrypted, err := crypto.Decrypt(pushoverConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ pushoverConfig.Token = decrypted
}
message := notifications.BuildBatchImageUpdateNotificationMessage(
@@ -2193,11 +2196,11 @@ func (s *NotificationService) sendEmailVulnerabilityNotification(ctx context.Con
}
}
if emailConfig.SMTPPassword != "" {
- if decrypted, err := crypto.Decrypt(emailConfig.SMTPPassword); err == nil {
- emailConfig.SMTPPassword = decrypted
- } else {
- slog.Warn("Failed to decrypt email SMTP password, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(emailConfig.SMTPPassword)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ emailConfig.SMTPPassword = decrypted
}
htmlBody, _, err := s.renderVulnerabilitySummaryEmailTemplate(environmentName, payload)
if err != nil {
@@ -2223,11 +2226,11 @@ func (s *NotificationService) sendDiscordVulnerabilityNotification(ctx context.C
return fmt.Errorf("discord webhook ID or token not configured")
}
if discordConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(discordConfig.Token); err == nil {
- discordConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Discord token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(discordConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ discordConfig.Token = decrypted
}
message := notifications.BuildVulnerabilitySummaryNotificationMessage(
notifications.MessageFormatMarkdown,
@@ -2260,11 +2263,11 @@ func (s *NotificationService) sendTelegramVulnerabilityNotification(ctx context.
return fmt.Errorf("no telegram chat IDs configured")
}
if telegramConfig.BotToken != "" {
- if decrypted, err := crypto.Decrypt(telegramConfig.BotToken); err == nil {
- telegramConfig.BotToken = decrypted
- } else {
- slog.Warn("Failed to decrypt Telegram bot token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(telegramConfig.BotToken)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ telegramConfig.BotToken = decrypted
}
if telegramConfig.ParseMode == "" {
telegramConfig.ParseMode = "HTML"
@@ -2297,14 +2300,18 @@ func (s *NotificationService) sendSignalVulnerabilityNotification(ctx context.Co
return fmt.Errorf("signal not fully configured")
}
if signalConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(signalConfig.Password); err == nil {
- signalConfig.Password = decrypted
+ decrypted, err := crypto.Decrypt(signalConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ signalConfig.Password = decrypted
}
if signalConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(signalConfig.Token); err == nil {
- signalConfig.Token = decrypted
+ decrypted, err := crypto.Decrypt(signalConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ signalConfig.Token = decrypted
}
message := notifications.BuildVulnerabilitySummaryNotificationMessage(
notifications.MessageFormatPlain,
@@ -2334,11 +2341,11 @@ func (s *NotificationService) sendSlackVulnerabilityNotification(ctx context.Con
return fmt.Errorf("slack token not configured")
}
if slackConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(slackConfig.Token); err == nil {
- slackConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Slack token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(slackConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ slackConfig.Token = decrypted
}
message := notifications.BuildVulnerabilitySummaryNotificationMessage(
notifications.MessageFormatSlack,
@@ -2368,9 +2375,11 @@ func (s *NotificationService) sendNtfyVulnerabilityNotification(ctx context.Cont
return fmt.Errorf("ntfy topic is required")
}
if ntfyConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(ntfyConfig.Password); err == nil {
- ntfyConfig.Password = decrypted
+ decrypted, err := crypto.Decrypt(ntfyConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ ntfyConfig.Password = decrypted
}
message := notifications.BuildVulnerabilitySummaryNotificationMessage(
notifications.MessageFormatPlain,
@@ -2400,9 +2409,11 @@ func (s *NotificationService) sendPushoverVulnerabilityNotification(ctx context.
return fmt.Errorf("pushover token or user not configured")
}
if pushoverConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(pushoverConfig.Token); err == nil {
- pushoverConfig.Token = decrypted
+ decrypted, err := crypto.Decrypt(pushoverConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ pushoverConfig.Token = decrypted
}
message := notifications.BuildVulnerabilitySummaryNotificationMessage(
notifications.MessageFormatPlain,
@@ -2432,9 +2443,11 @@ func (s *NotificationService) sendGotifyVulnerabilityNotification(ctx context.Co
return fmt.Errorf("failed to unmarshal Gotify config: %w", err)
}
if gotifyConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(gotifyConfig.Token); err == nil {
- gotifyConfig.Token = decrypted
+ decrypted, err := crypto.Decrypt(gotifyConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ gotifyConfig.Token = decrypted
}
message := notifications.BuildVulnerabilitySummaryNotificationMessage(
notifications.MessageFormatPlain,
@@ -2464,9 +2477,11 @@ func (s *NotificationService) sendMatrixVulnerabilityNotification(ctx context.Co
return fmt.Errorf("failed to unmarshal Matrix config: %w", err)
}
if matrixConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(matrixConfig.Password); err == nil {
- matrixConfig.Password = decrypted
+ decrypted, err := crypto.Decrypt(matrixConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ matrixConfig.Password = decrypted
}
message := notifications.BuildVulnerabilitySummaryNotificationMessage(
notifications.MessageFormatPlain,
@@ -2550,11 +2565,11 @@ func (s *NotificationService) sendGotifyNotification(ctx context.Context, enviro
}
if gotifyConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(gotifyConfig.Token); err == nil {
- gotifyConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Gotify token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(gotifyConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ gotifyConfig.Token = decrypted
}
message := notifications.BuildImageUpdateNotificationMessage(
@@ -2582,11 +2597,11 @@ func (s *NotificationService) sendGotifyContainerUpdateNotification(ctx context.
}
if gotifyConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(gotifyConfig.Token); err == nil {
- gotifyConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Gotify token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(gotifyConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ gotifyConfig.Token = decrypted
}
message := notifications.BuildContainerUpdateNotificationMessage(
@@ -2616,9 +2631,11 @@ func (s *NotificationService) sendBatchGotifyNotification(ctx context.Context, e
}
if gotifyConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(gotifyConfig.Token); err == nil {
- gotifyConfig.Token = decrypted
+ decrypted, err := crypto.Decrypt(gotifyConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ gotifyConfig.Token = decrypted
}
message := notifications.BuildBatchImageUpdateNotificationMessage(
@@ -2645,9 +2662,11 @@ func (s *NotificationService) sendMatrixNotification(ctx context.Context, enviro
}
if matrixConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(matrixConfig.Password); err == nil {
- matrixConfig.Password = decrypted
+ decrypted, err := crypto.Decrypt(matrixConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ matrixConfig.Password = decrypted
}
message := notifications.BuildImageUpdateNotificationMessage(
@@ -2675,9 +2694,11 @@ func (s *NotificationService) sendMatrixContainerUpdateNotification(ctx context.
}
if matrixConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(matrixConfig.Password); err == nil {
- matrixConfig.Password = decrypted
+ decrypted, err := crypto.Decrypt(matrixConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ matrixConfig.Password = decrypted
}
message := notifications.BuildContainerUpdateNotificationMessage(
@@ -2707,9 +2728,11 @@ func (s *NotificationService) sendBatchMatrixNotification(ctx context.Context, e
}
if matrixConfig.Password != "" {
- if decrypted, err := crypto.Decrypt(matrixConfig.Password); err == nil {
- matrixConfig.Password = decrypted
+ decrypted, err := crypto.Decrypt(matrixConfig.Password)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ matrixConfig.Password = decrypted
}
message := notifications.BuildBatchImageUpdateNotificationMessage(
@@ -2725,103 +2748,6 @@ func (s *NotificationService) sendBatchMatrixNotification(ctx context.Context, e
return nil
}
-// MigrateDiscordWebhookUrlToFields migrates legacy Discord webhookUrl to separate webhookId and token fields.
-// This should be called during bootstrap to ensure existing Discord configurations are preserved.
-func (s *NotificationService) MigrateDiscordWebhookUrlToFields(ctx context.Context) error {
- var setting models.NotificationSettings
- err := s.db.WithContext(ctx).Where("provider = ?", models.NotificationProviderDiscord).First(&setting).Error
- if err != nil {
- if errors.Is(err, gorm.ErrRecordNotFound) {
- // No Discord config exists, nothing to migrate
- return nil
- }
- return fmt.Errorf("failed to query Discord settings: %w", err)
- }
-
- var discordConfig models.DiscordConfig
- configBytes, err := json.Marshal(setting.Config)
- if err != nil {
- return fmt.Errorf("failed to marshal Discord config: %w", err)
- }
- if err := json.Unmarshal(configBytes, &discordConfig); err != nil {
- slog.WarnContext(ctx, "Failed to parse Discord config for migration", "error", err)
- return nil
- }
-
- // Check if already migrated (has webhookId and token)
- if discordConfig.WebhookID != "" && discordConfig.Token != "" {
- slog.DebugContext(ctx, "Discord config already migrated, skipping")
- return nil
- }
-
- // Check for legacy webhookUrl field
- var legacyConfig struct {
- WebhookUrl string `json:"webhookUrl"`
- Username string `json:"username,omitempty"`
- AvatarURL string `json:"avatarUrl,omitempty"`
- Events map[models.NotificationEventType]bool `json:"events,omitempty"`
- }
- if err := json.Unmarshal(configBytes, &legacyConfig); err != nil {
- slog.WarnContext(ctx, "Failed to parse legacy Discord config structure", "error", err)
- return nil
- }
-
- if legacyConfig.WebhookUrl == "" {
- slog.DebugContext(ctx, "No legacy webhookUrl to migrate")
- return nil
- }
-
- // Parse webhook URL: https://discord.com/api/webhooks/{id}/{token}
- parts := strings.Split(legacyConfig.WebhookUrl, "/webhooks/")
- if len(parts) != 2 {
- slog.WarnContext(ctx, "Invalid Discord webhook URL format, skipping migration", "url", legacyConfig.WebhookUrl)
- return nil
- }
-
- webhookParts := strings.Split(parts[1], "/")
- if len(webhookParts) != 2 {
- slog.WarnContext(ctx, "Invalid Discord webhook URL format, skipping migration", "url", legacyConfig.WebhookUrl)
- return nil
- }
-
- webhookID := webhookParts[0]
- token := webhookParts[1]
-
- slog.InfoContext(ctx, "Migrating legacy Discord webhookUrl to webhookId and token")
-
- // Encrypt token before storing
- encryptedToken, err := crypto.Encrypt(token)
- if err != nil {
- return fmt.Errorf("failed to encrypt Discord token: %w", err)
- }
-
- // Update with new structure
- newConfig := models.DiscordConfig{
- WebhookID: webhookID,
- Token: encryptedToken,
- Username: legacyConfig.Username,
- AvatarURL: legacyConfig.AvatarURL,
- Events: legacyConfig.Events,
- }
-
- var configMap models.JSON
- newConfigBytes, err := json.Marshal(newConfig)
- if err != nil {
- return fmt.Errorf("failed to marshal new Discord config: %w", err)
- }
- if err = json.Unmarshal(newConfigBytes, &configMap); err != nil {
- return fmt.Errorf("failed to unmarshal new Discord config to JSON: %w", err)
- }
-
- setting.Config = configMap
- if err = s.db.WithContext(ctx).Save(&setting).Error; err != nil {
- return fmt.Errorf("failed to save migrated Discord config: %w", err)
- }
-
- slog.InfoContext(ctx, "Successfully migrated Discord config")
- return nil
-}
-
func (s *NotificationService) SendPruneReportNotification(ctx context.Context, result *system.PruneAllResult) error {
hasChanges := pruneResultHasChangesInternal(result)
hasErrors := result != nil && len(result.Errors) > 0
@@ -2956,7 +2882,9 @@ func (s *NotificationService) sendDiscordPruneNotification(ctx context.Context,
return fmt.Errorf("discord webhook ID or token not configured")
}
- s.decryptDiscordTokenInternal(&discordConfig)
+ if err := s.decryptDiscordTokenInternal(&discordConfig); err != nil {
+ return err
+ }
message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatMarkdown, environmentName, result)
@@ -2977,7 +2905,9 @@ func (s *NotificationService) sendTelegramPruneNotification(ctx context.Context,
return fmt.Errorf("telegram bot token or chat IDs not configured")
}
- s.decryptTelegramTokenInternal(&telegramConfig)
+ if err := s.decryptTelegramTokenInternal(&telegramConfig); err != nil {
+ return err
+ }
message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatHTML, environmentName, result)
@@ -3002,7 +2932,9 @@ func (s *NotificationService) sendEmailPruneNotification(ctx context.Context, en
return err
}
- s.decryptEmailPasswordInternal(&emailConfig)
+ if err := s.decryptEmailPasswordInternal(&emailConfig); err != nil {
+ return err
+ }
htmlBody, _, err := s.renderPruneReportEmailTemplate(environmentName, result)
if err != nil {
@@ -3089,11 +3021,11 @@ func (s *NotificationService) sendGotifyPruneNotification(ctx context.Context, e
return err
}
if gotifyConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(gotifyConfig.Token); err == nil {
- gotifyConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Gotify token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(gotifyConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ gotifyConfig.Token = decrypted
}
message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatPlain, environmentName, result)
@@ -3220,7 +3152,9 @@ func (s *NotificationService) sendDiscordAutoHealNotification(ctx context.Contex
if discordConfig.WebhookID == "" || discordConfig.Token == "" {
return fmt.Errorf("discord webhook ID or token not configured")
}
- s.decryptDiscordTokenInternal(&discordConfig)
+ if err := s.decryptDiscordTokenInternal(&discordConfig); err != nil {
+ return err
+ }
message := notifications.BuildAutoHealNotificationMessage(notifications.MessageFormatMarkdown, environmentName, containerName)
return notifications.SendDiscord(ctx, discordConfig, message)
}
@@ -3233,7 +3167,9 @@ func (s *NotificationService) sendEmailAutoHealNotification(ctx context.Context,
if err := s.validateEmailConfigInternal(&emailConfig); err != nil {
return err
}
- s.decryptEmailPasswordInternal(&emailConfig)
+ if err := s.decryptEmailPasswordInternal(&emailConfig); err != nil {
+ return err
+ }
subject := notifications.BuildEmailSubject(environmentName, fmt.Sprintf("Auto Heal: Container '%s' Restarted", containerName))
body := fmt.Sprintf(
"<p><strong>Environment:</strong> %s</p><p><strong>Container:</strong> %s</p><p>Automatically restarted because it was unhealthy.</p>",
@@ -3251,7 +3187,9 @@ func (s *NotificationService) sendTelegramAutoHealNotification(ctx context.Conte
if telegramConfig.BotToken == "" || len(telegramConfig.ChatIDs) == 0 {
return fmt.Errorf("telegram bot token or chat IDs not configured")
}
- s.decryptTelegramTokenInternal(&telegramConfig)
+ if err := s.decryptTelegramTokenInternal(&telegramConfig); err != nil {
+ return err
+ }
if telegramConfig.ParseMode == "" {
telegramConfig.ParseMode = "HTML"
}
@@ -3304,11 +3242,11 @@ func (s *NotificationService) sendGotifyAutoHealNotification(ctx context.Context
return err
}
if gotifyConfig.Token != "" {
- if decrypted, err := crypto.Decrypt(gotifyConfig.Token); err == nil {
- gotifyConfig.Token = decrypted
- } else {
- slog.Warn("Failed to decrypt Gotify token, using raw value (may be unencrypted legacy value)", "error", err)
+ decrypted, err := crypto.Decrypt(gotifyConfig.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ gotifyConfig.Token = decrypted
}
if gotifyConfig.Title == "" {
gotifyConfig.Title = notifications.BuildEmailSubject(environmentName, "Auto Heal")
@@ -3358,28 +3296,37 @@ func (s *NotificationService) validateEmailConfigInternal(config *models.EmailCo
return nil
}
-func (s *NotificationService) decryptDiscordTokenInternal(config *models.DiscordConfig) {
+func (s *NotificationService) decryptDiscordTokenInternal(config *models.DiscordConfig) error {
if config.Token != "" {
- if decrypted, err := crypto.Decrypt(config.Token); err == nil {
- config.Token = decrypted
+ decrypted, err := crypto.Decrypt(config.Token)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ config.Token = decrypted
}
+ return nil
}
-func (s *NotificationService) decryptTelegramTokenInternal(config *models.TelegramConfig) {
+func (s *NotificationService) decryptTelegramTokenInternal(config *models.TelegramConfig) error {
if config.BotToken != "" {
- if decrypted, err := crypto.Decrypt(config.BotToken); err == nil {
- config.BotToken = decrypted
+ decrypted, err := crypto.Decrypt(config.BotToken)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ config.BotToken = decrypted
}
+ return nil
}
-func (s *NotificationService) decryptEmailPasswordInternal(config *models.EmailConfig) {
+func (s *NotificationService) decryptEmailPasswordInternal(config *models.EmailConfig) error {
if config.SMTPPassword != "" {
- if decrypted, err := crypto.Decrypt(config.SMTPPassword); err == nil {
- config.SMTPPassword = decrypted
+ decrypted, err := crypto.Decrypt(config.SMTPPassword)
+ if err != nil {
+ return fmt.Errorf("failed to decrypt notification credential: %w", err)
}
+ config.SMTPPassword = decrypted
}
+ return nil
}
func (s *NotificationService) renderTemplatesInternal(name string, data any) (string, string, error) {
diff --git a/backend/internal/services/notification_service_test.go b/backend/internal/services/notification_service_test.go
index ed674855b..203c7bfb1 100644
--- a/backend/internal/services/notification_service_test.go
+++ b/backend/internal/services/notification_service_test.go
@@ -31,7 +31,7 @@ func setupNotificationTestDB(t *testing.T) *database.DB {
t.Helper()
db, err := gorm.Open(glsqlite.Open(":memory:"), &gorm.Config{})
require.NoError(t, err)
- require.NoError(t, db.AutoMigrate(&models.NotificationSettings{}, &models.SettingVariable{}, &models.NotificationLog{}, &models.Environment{}, &models.AppriseSettings{}))
+ require.NoError(t, db.AutoMigrate(&models.NotificationSettings{}, &models.SettingVariable{}, &models.NotificationLog{}, &models.Environment{}))
// Initialize crypto for tests (requires 32+ byte key)
testCfg := &config.Config{
@@ -84,263 +84,6 @@ func captureNotificationServiceLogsInternal(t *testing.T) *bytes.Buffer {
return &buf
}
-func TestNotificationService_MigrateDiscordWebhookUrlToFields(t *testing.T) {
- ctx := context.Background()
- db, _, svc := setupNotificationTestServiceInternal(t)
-
- // Create legacy Discord config with webhookUrl
- legacyConfig := map[string]any{
- "webhookUrl": "https://discord.com/api/webhooks/123456789/abcdef123456",
- "username": "Arcane Bot",
- "avatarUrl": "https://example.com/avatar.png",
- "events": map[string]bool{
- "image_update": true,
- "container_update": false,
- },
- }
-
- configBytes, err := json.Marshal(legacyConfig)
- require.NoError(t, err)
-
- var configJSON models.JSON
- require.NoError(t, json.Unmarshal(configBytes, &configJSON))
-
- setting := models.NotificationSettings{
- Provider: models.NotificationProviderDiscord,
- Enabled: true,
- Config: configJSON,
- }
- require.NoError(t, db.Create(&setting).Error)
-
- // Run migration
- err = svc.MigrateDiscordWebhookUrlToFields(ctx)
- require.NoError(t, err)
-
- // Verify migration results
- var migratedSetting models.NotificationSettings
- require.NoError(t, db.Where("provider = ?", models.NotificationProviderDiscord).First(&migratedSetting).Error)
-
- var discordConfig models.DiscordConfig
- configBytes, err = json.Marshal(migratedSetting.Config)
- require.NoError(t, err)
- require.NoError(t, json.Unmarshal(configBytes, &discordConfig))
-
- // Verify webhookId and token were extracted
- require.Equal(t, "123456789", discordConfig.WebhookID)
- require.NotEmpty(t, discordConfig.Token)
-
- // Verify token is encrypted and can be decrypted
- decryptedToken, err := crypto.Decrypt(discordConfig.Token)
- require.NoError(t, err)
- require.Equal(t, "abcdef123456", decryptedToken)
-
- // Verify other fields were preserved
- require.Equal(t, "Arcane Bot", discordConfig.Username)
- require.Equal(t, "https://example.com/avatar.png", discordConfig.AvatarURL)
- require.True(t, discordConfig.Events[models.NotificationEventImageUpdate])
- require.False(t, discordConfig.Events[models.NotificationEventContainerUpdate])
-}
-
-func TestNotificationService_MigrateDiscordWebhookUrlToFields_SkipsIfAlreadyMigrated(t *testing.T) {
- ctx := context.Background()
- db, _, svc := setupNotificationTestServiceInternal(t)
-
- // Create already-migrated config with webhookId and token
- encryptedToken, err := crypto.Encrypt("already-migrated-token")
- require.NoError(t, err)
-
- migratedConfig := models.DiscordConfig{
- WebhookID: "999999999",
- Token: encryptedToken,
- Username: "Already Migrated",
- }
-
- configBytes, err := json.Marshal(migratedConfig)
- require.NoError(t, err)
-
- var configJSON models.JSON
- require.NoError(t, json.Unmarshal(configBytes, &configJSON))
-
- setting := models.NotificationSettings{
- Provider: models.NotificationProviderDiscord,
- Enabled: true,
- Config: configJSON,
- }
- require.NoError(t, db.Create(&setting).Error)
-
- // Run migration - should skip
- err = svc.MigrateDiscordWebhookUrlToFields(ctx)
- require.NoError(t, err)
-
- // Verify config was NOT changed
- var unchangedSetting models.NotificationSettings
- require.NoError(t, db.Where("provider = ?", models.NotificationProviderDiscord).First(&unchangedSetting).Error)
-
- var discordConfig models.DiscordConfig
- configBytes, err = json.Marshal(unchangedSetting.Config)
- require.NoError(t, err)
- require.NoError(t, json.Unmarshal(configBytes, &discordConfig))
-
- require.Equal(t, "999999999", discordConfig.WebhookID)
- require.Equal(t, encryptedToken, discordConfig.Token)
- require.Equal(t, "Already Migrated", discordConfig.Username)
-}
-
-func TestNotificationService_MigrateDiscordWebhookUrlToFields_NoDiscordConfig(t *testing.T) {
- ctx := context.Background()
- db, _, svc := setupNotificationTestServiceInternal(t)
-
- // No Discord config exists - migration should not error
- err := svc.MigrateDiscordWebhookUrlToFields(ctx)
- require.NoError(t, err)
-
- // Verify no settings were created
- var count int64
- require.NoError(t, db.Model(&models.NotificationSettings{}).Count(&count).Error)
- require.Equal(t, int64(0), count)
-}
-
-func TestNotificationService_MigrateDiscordWebhookUrlToFields_InvalidWebhookUrl(t *testing.T) {
- ctx := context.Background()
- db, _, svc := setupNotificationTestServiceInternal(t)
-
- testCases := []struct {
- name string
- webhookUrl string
- }{
- {
- name: "missing webhooks path",
- webhookUrl: "https://discord.com/api/other/123456789/abcdef",
- },
- {
- name: "incomplete webhook path",
- webhookUrl: "https://discord.com/api/webhooks/123456789",
- },
- {
- name: "empty webhook url",
- webhookUrl: "",
- },
- }
-
- for _, tc := range testCases {
- t.Run(tc.name, func(t *testing.T) {
- // Clean up before each sub-test
- db.Exec("DELETE FROM notification_settings")
-
- legacyConfig := map[string]any{
- "webhookUrl": tc.webhookUrl,
- }
-
- configBytes, err := json.Marshal(legacyConfig)
- require.NoError(t, err)
-
- var configJSON models.JSON
- require.NoError(t, json.Unmarshal(configBytes, &configJSON))
-
- setting := models.NotificationSettings{
- Provider: models.NotificationProviderDiscord,
- Enabled: true,
- Config: configJSON,
- }
- require.NoError(t, db.Create(&setting).Error)
-
- // Migration should not error but should skip invalid URLs
- err = svc.MigrateDiscordWebhookUrlToFields(ctx)
- require.NoError(t, err)
-
- // Verify config was not changed
- var unchangedSetting models.NotificationSettings
- require.NoError(t, db.Where("provider = ?", models.NotificationProviderDiscord).First(&unchangedSetting).Error)
-
- var resultConfig map[string]any
- configBytes, err = json.Marshal(unchangedSetting.Config)
- require.NoError(t, err)
- require.NoError(t, json.Unmarshal(configBytes, &resultConfig))
-
- // Should still have webhookUrl (not migrated)
- if tc.webhookUrl != "" {
- require.Equal(t, tc.webhookUrl, resultConfig["webhookUrl"])
- }
- })
- }
-}
-
-func TestNotificationService_MigrateDiscordWebhookUrlToFields_EmptyConfig(t *testing.T) {
- ctx := context.Background()
- db, _, svc := setupNotificationTestServiceInternal(t)
-
- // Create Discord setting with empty config
- setting := models.NotificationSettings{
- Provider: models.NotificationProviderDiscord,
- Enabled: false,
- Config: models.JSON{},
- }
- require.NoError(t, db.Create(&setting).Error)
-
- // Migration should not error
- err := svc.MigrateDiscordWebhookUrlToFields(ctx)
- require.NoError(t, err)
-
- // Verify config remains empty
- var unchangedSetting models.NotificationSettings
- require.NoError(t, db.Where("provider = ?", models.NotificationProviderDiscord).First(&unchangedSetting).Error)
- require.Empty(t, unchangedSetting.Config)
-}
-
-func TestNotificationService_MigrateDiscordWebhookUrlToFields_PreservesAllFields(t *testing.T) {
- ctx := context.Background()
- db, _, svc := setupNotificationTestServiceInternal(t)
-
- // Create legacy config with all optional fields
- legacyConfig := map[string]any{
- "webhookUrl": "https://discord.com/api/webhooks/111222333/token444555",
- "username": "Custom Bot Name",
- "avatarUrl": "https://cdn.example.com/bot-avatar.jpg",
- "events": map[string]bool{
- "image_update": false,
- "container_update": true,
- },
- }
-
- configBytes, err := json.Marshal(legacyConfig)
- require.NoError(t, err)
-
- var configJSON models.JSON
- require.NoError(t, json.Unmarshal(configBytes, &configJSON))
-
- setting := models.NotificationSettings{
- Provider: models.NotificationProviderDiscord,
- Enabled: true,
- Config: configJSON,
- }
- require.NoError(t, db.Create(&setting).Error)
-
- // Run migration
- err = svc.MigrateDiscordWebhookUrlToFields(ctx)
- require.NoError(t, err)
-
- // Verify all fields were preserved
- var migratedSetting models.NotificationSettings
- require.NoError(t, db.Where("provider = ?", models.NotificationProviderDiscord).First(&migratedSetting).Error)
-
- var discordConfig models.DiscordConfig
- configBytes, err = json.Marshal(migratedSetting.Config)
- require.NoError(t, err)
- require.NoError(t, json.Unmarshal(configBytes, &discordConfig))
-
- require.Equal(t, "111222333", discordConfig.WebhookID)
- require.NotEmpty(t, discordConfig.Token)
-
- decryptedToken, err := crypto.Decrypt(discordConfig.Token)
- require.NoError(t, err)
- require.Equal(t, "token444555", decryptedToken)
-
- require.Equal(t, "Custom Bot Name", discordConfig.Username)
- require.Equal(t, "https://cdn.example.com/bot-avatar.jpg", discordConfig.AvatarURL)
- require.False(t, discordConfig.Events[models.NotificationEventImageUpdate])
- require.True(t, discordConfig.Events[models.NotificationEventContainerUpdate])
-}
-
func TestNotificationService_ResolveNotificationTargetInternal_UsesEnvironmentRecordAndFallback(t *testing.T) {
ctx := context.Background()
db, _, svc := setupNotificationTestServiceInternal(t)
diff --git a/backend/internal/services/settings_service.go b/backend/internal/services/settings_service.go
index 50f6d95ce..0abf07f03 100644
--- a/backend/internal/services/settings_service.go
+++ b/backend/internal/services/settings_service.go
@@ -4,7 +4,6 @@ import (
"context"
"crypto/sha256"
"encoding/base64"
- "encoding/json"
"errors"
"fmt"
"log/slog"
@@ -122,15 +121,9 @@ func DefaultSettingsConfig() *models.Settings {
EventCleanupInterval: models.SettingVariable{Value: "0 0 */6 * * *"},
ExpiredSessionsCleanupInterval: models.SettingVariable{Value: "0 0 0 * * *"},
AutoInjectEnv: models.SettingVariable{Value: "false"},
- PruneMode: models.SettingVariable{Value: "dangling"}, //nolint:staticcheck // Legacy prune setting is still seeded for migration compatibility.
DefaultDeployPullPolicy: models.SettingVariable{Value: "missing"},
ScheduledPruneEnabled: models.SettingVariable{Value: "false"},
ScheduledPruneInterval: models.SettingVariable{Value: "0 0 0 * * *"},
- ScheduledPruneContainers: models.SettingVariable{Value: "true"}, //nolint:staticcheck // Legacy prune setting is still seeded for migration compatibility.
- ScheduledPruneImages: models.SettingVariable{Value: "true"}, //nolint:staticcheck // Legacy prune setting is still seeded for migration compatibility.
- ScheduledPruneVolumes: models.SettingVariable{Value: "false"}, //nolint:staticcheck // Legacy prune setting is still seeded for migration compatibility.
- ScheduledPruneNetworks: models.SettingVariable{Value: "true"}, //nolint:staticcheck // Legacy prune setting is still seeded for migration compatibility.
- ScheduledPruneBuildCache: models.SettingVariable{Value: "false"}, //nolint:staticcheck // Legacy prune setting is still seeded for migration compatibility.
PruneContainerMode: models.SettingVariable{Value: "stopped"},
PruneContainerUntil: models.SettingVariable{Value: ""},
PruneImageMode: models.SettingVariable{Value: "dangling"},
@@ -166,37 +159,35 @@ func DefaultSettingsConfig() *models.Settings {
TrivyCpuLimit: models.SettingVariable{Value: "1"},
TrivyMemoryLimitMb: models.SettingVariable{Value: "0"},
TrivyConcurrentScanContainers: models.SettingVariable{Value: "1"},
- // AuthOidcConfig DEPRECATED will be removed in a future release
- AuthOidcConfig: models.SettingVariable{Value: "{}"},
- OidcEnabled: models.SettingVariable{Value: "false"},
- OidcClientId: models.SettingVariable{Value: ""},
- OidcClientSecret: models.SettingVariable{Value: ""},
- OidcIssuerUrl: models.SettingVariable{Value: ""},
- OidcAuthorizationEndpoint: models.SettingVariable{Value: ""},
- OidcTokenEndpoint: models.SettingVariable{Value: ""},
- OidcUserinfoEndpoint: models.SettingVariable{Value: ""},
- OidcJwksEndpoint: models.SettingVariable{Value: ""},
- OidcScopes: models.SettingVariable{Value: "openid email profile"},
- OidcAdminClaim: models.SettingVariable{Value: ""},
- OidcAdminValue: models.SettingVariable{Value: ""},
- OidcSkipTlsVerify: models.SettingVariable{Value: "false"},
- OidcAutoRedirectToProvider: models.SettingVariable{Value: "false"},
- OidcMergeAccounts: models.SettingVariable{Value: "false"},
- OidcProviderName: models.SettingVariable{Value: ""},
- OidcProviderLogoUrl: models.SettingVariable{Value: ""},
- OidcMobileRedirectUris: models.SettingVariable{Value: "arcane-mobile://oidc-callback"},
- MobileNavigationMode: models.SettingVariable{Value: "floating"},
- MobileNavigationShowLabels: models.SettingVariable{Value: "true"},
- SidebarHoverExpansion: models.SettingVariable{Value: "true"},
- KeyboardShortcutsEnabled: models.SettingVariable{Value: "true"},
- ApplicationTheme: models.SettingVariable{Value: "default"},
- AccentColor: models.SettingVariable{Value: "oklch(0.606 0.25 292.717)"},
- OledMode: models.SettingVariable{Value: "false"},
- MaxImageUploadSize: models.SettingVariable{Value: "500"},
- GitSyncMaxFiles: models.SettingVariable{Value: "500"},
- GitSyncMaxTotalSizeMb: models.SettingVariable{Value: "50"},
- GitSyncMaxBinarySizeMb: models.SettingVariable{Value: "10"},
- EnvironmentHealthInterval: models.SettingVariable{Value: "0 */2 * * * *"},
+ OidcEnabled: models.SettingVariable{Value: "false"},
+ OidcClientId: models.SettingVariable{Value: ""},
+ OidcClientSecret: models.SettingVariable{Value: ""},
+ OidcIssuerUrl: models.SettingVariable{Value: ""},
+ OidcAuthorizationEndpoint: models.SettingVariable{Value: ""},
+ OidcTokenEndpoint: models.SettingVariable{Value: ""},
+ OidcUserinfoEndpoint: models.SettingVariable{Value: ""},
+ OidcJwksEndpoint: models.SettingVariable{Value: ""},
+ OidcScopes: models.SettingVariable{Value: "openid email profile"},
+ OidcAdminClaim: models.SettingVariable{Value: ""},
+ OidcAdminValue: models.SettingVariable{Value: ""},
+ OidcSkipTlsVerify: models.SettingVariable{Value: "false"},
+ OidcAutoRedirectToProvider: models.SettingVariable{Value: "false"},
+ OidcMergeAccounts: models.SettingVariable{Value: "false"},
+ OidcProviderName: models.SettingVariable{Value: ""},
+ OidcProviderLogoUrl: models.SettingVariable{Value: ""},
+ OidcMobileRedirectUris: models.SettingVariable{Value: "arcane-mobile://oidc-callback"},
+ MobileNavigationMode: models.SettingVariable{Value: "floating"},
+ MobileNavigationShowLabels: models.SettingVariable{Value: "true"},
+ SidebarHoverExpansion: models.SettingVariable{Value: "true"},
+ KeyboardShortcutsEnabled: models.SettingVariable{Value: "true"},
+ ApplicationTheme: models.SettingVariable{Value: "default"},
+ AccentColor: models.SettingVariable{Value: "oklch(0.606 0.25 292.717)"},
+ OledMode: models.SettingVariable{Value: "false"},
+ MaxImageUploadSize: models.SettingVariable{Value: "500"},
+ GitSyncMaxFiles: models.SettingVariable{Value: "500"},
+ GitSyncMaxTotalSizeMb: models.SettingVariable{Value: "50"},
+ GitSyncMaxBinarySizeMb: models.SettingVariable{Value: "10"},
+ EnvironmentHealthInterval: models.SettingVariable{Value: "0 */2 * * * *"},
DockerAPITimeout: models.SettingVariable{Value: "30"},
DockerImagePullTimeout: models.SettingVariable{Value: "600"},
@@ -232,22 +223,6 @@ func (s *SettingsService) loadDatabaseSettingsInternal(ctx context.Context, db *
return nil, fmt.Errorf("failed to load configuration from the database: %w", err)
}
- updated, err := s.ensureGranularPruneSettingsMigratedInternal(ctx, db, loaded) //nolint:staticcheck // Legacy prune migration remains temporarily for backward compatibility.
- if err != nil {
- return nil, err
- }
- if updated {
- loaded = nil
- queryCtx, queryCancel = context.WithTimeout(ctx, 10*time.Second)
- defer queryCancel()
- err = db.
- WithContext(queryCtx).
- Find(&loaded).Error
- if err != nil {
- return nil, fmt.Errorf("failed to reload configuration from the database after prune migration: %w", err)
- }
- }
-
for _, v := range loaded {
err = dest.UpdateField(v.Key, v.Value, false)
@@ -262,144 +237,6 @@ func (s *SettingsService) loadDatabaseSettingsInternal(ctx context.Context, db *
return dest, nil
}
-// Deprecated: This migration path exists only to lift legacy prune settings into the granular model.
-func (s *SettingsService) ensureGranularPruneSettingsMigratedInternal(ctx context.Context, db *database.DB, loaded []models.SettingVariable) (bool, error) {
- loadedMap := make(map[string]string, len(loaded))
- for _, setting := range loaded {
- loadedMap[setting.Key] = setting.Value
- }
-
- missingKeys := []string{
- "pruneContainerMode",
- "pruneContainerUntil",
- "pruneImageMode",
- "pruneImageUntil",
- "pruneVolumeMode",
- "pruneNetworkMode",
- "pruneNetworkUntil",
- "pruneBuildCacheMode",
- "pruneBuildCacheUntil",
- }
-
- needsMigration := false
- for _, key := range missingKeys {
- if _, ok := loadedMap[key]; !ok {
- needsMigration = true
- break
- }
- }
-
- if !needsMigration {
- return false, nil
- }
-
- pruneMode := loadedMap["dockerPruneMode"]
- if pruneMode == "" {
- pruneMode = "dangling"
- }
-
- valuesToPersist := []models.SettingVariable{
- {Key: "pruneContainerMode", Value: coalesceSettingValueInternal(loadedMap, migrateLegacyContainerPruneModeInternal(loadedMap["scheduledPruneContainers"]), "pruneContainerMode", "scheduledPruneContainerMode")}, //nolint:staticcheck // Legacy prune migration remains temporarily for backward compatibility.
- {Key: "pruneContainerUntil", Value: coalesceSettingValueInternal(loadedMap, "", "pruneContainerUntil", "scheduledPruneContainerUntil")},
- {Key: "pruneImageMode", Value: coalesceSettingValueInternal(loadedMap, migrateLegacyImagePruneModeInternal(pruneMode, loadedMap["scheduledPruneImages"]), "pruneImageMode", "scheduledPruneImageMode")}, //nolint:staticcheck // Legacy prune migration remains temporarily for backward compatibility.
- {Key: "pruneImageUntil", Value: coalesceSettingValueInternal(loadedMap, "", "pruneImageUntil", "scheduledPruneImageUntil")},
- {Key: "pruneVolumeMode", Value: coalesceSettingValueInternal(loadedMap, migrateLegacyVolumePruneModeInternal(pruneMode, loadedMap["scheduledPruneVolumes"]), "pruneVolumeMode", "scheduledPruneVolumeMode")}, //nolint:staticcheck // Legacy prune migration remains temporarily for backward compatibility.
- {Key: "pruneNetworkMode", Value: coalesceSettingValueInternal(loadedMap, migrateLegacyNetworkPruneModeInternal(loadedMap["scheduledPruneNetworks"]), "pruneNetworkMode", "scheduledPruneNetworkMode")}, //nolint:staticcheck // Legacy prune migration remains temporarily for backward compatibility.
- {Key: "pruneNetworkUntil", Value: coalesceSettingValueInternal(loadedMap, "", "pruneNetworkUntil", "scheduledPruneNetworkUntil")},
- {Key: "pruneBuildCacheMode", Value: coalesceSettingValueInternal(loadedMap, migrateLegacyBuildCachePruneModeInternal(pruneMode, loadedMap["scheduledPruneBuildCache"]), "pruneBuildCacheMode", "scheduledPruneBuildCacheMode")}, //nolint:staticcheck // Legacy prune migration remains temporarily for backward compatibility.
- {Key: "pruneBuildCacheUntil", Value: coalesceSettingValueInternal(loadedMap, "", "pruneBuildCacheUntil", "scheduledPruneBuildCacheUntil")},
- }
-
- if err := db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
- for _, value := range valuesToPersist {
- if _, ok := loadedMap[value.Key]; ok {
- continue
- }
- if err := tx.Save(&value).Error; err != nil {
- return fmt.Errorf("failed to persist migrated prune setting %s: %w", value.Key, err)
- }
- }
- return nil
- }); err != nil {
- return false, fmt.Errorf("failed to migrate granular prune settings: %w", err)
- }
-
- slog.InfoContext(ctx, "migrated legacy prune settings to granular prune settings")
- return true, nil
-}
-
-// Deprecated: This migration helper exists only to translate legacy prune settings.
-func migrateLegacyContainerPruneModeInternal(legacyValue string) string {
- if isLegacyPruneEnabledInternal(legacyValue, true) {
- return "stopped"
- }
- return "none"
-}
-
-// Deprecated: This migration helper exists only to translate legacy prune settings.
-func migrateLegacyImagePruneModeInternal(pruneMode, legacyValue string) string {
- if !isLegacyPruneEnabledInternal(legacyValue, true) {
- return "none"
- }
- if pruneMode == "all" {
- return "all"
- }
- return "dangling"
-}
-
-// Deprecated: This migration helper exists only to translate legacy prune settings.
-func migrateLegacyVolumePruneModeInternal(pruneMode, legacyValue string) string {
- if !isLegacyPruneEnabledInternal(legacyValue, false) {
- return "none"
- }
- if pruneMode == "all" {
- return "all"
- }
- return "anonymous"
-}
-
-// Deprecated: This migration helper exists only to translate legacy prune settings.
-func migrateLegacyNetworkPruneModeInternal(legacyValue string) string {
- if isLegacyPruneEnabledInternal(legacyValue, true) {
- return "unused"
- }
- return "none"
-}
-
-// Deprecated: This migration helper exists only to translate legacy prune settings.
-func migrateLegacyBuildCachePruneModeInternal(pruneMode, legacyValue string) string {
- if !isLegacyPruneEnabledInternal(legacyValue, false) {
- return "none"
- }
- if pruneMode == "all" {
- return "all"
- }
- return "unused"
-}
-
-func isLegacyPruneEnabledInternal(value string, defaultValue bool) bool {
- if strings.TrimSpace(value) == "" {
- return defaultValue
- }
-
- parsed, err := strconv.ParseBool(value)
- if err != nil {
- return defaultValue
- }
-
- return parsed
-}
-
-func coalesceSettingValueInternal(loadedMap map[string]string, fallback string, keys ...string) string {
- for _, key := range keys {
- if value, ok := loadedMap[key]; ok {
- return value
- }
- }
-
- return fallback
-}
-
func (s *SettingsService) loadDatabaseConfigFromEnv(ctx context.Context, db *database.DB) (*models.Settings, error) {
dest := s.getDefaultSettings()
@@ -544,113 +381,6 @@ func (s *SettingsService) getEffectiveSettingsConfigInternal(ctx context.Context
return settings
}
-// MigrateOidcConfigToFields migrates the legacy JSON authOidcConfig to individual fields,
-// and renames legacy auth* keys to their new oidc* names.
-// This should be called during bootstrap to ensure existing configurations are preserved.
-func (s *SettingsService) MigrateOidcConfigToFields(ctx context.Context) error {
- currentSettings, err := s.GetSettings(ctx)
- if err != nil {
- return fmt.Errorf("failed to get settings for OIDC migration: %w", err)
- }
-
- // Migrate legacy key names (authOidcEnabled -> oidcEnabled, authOidcMergeAccounts -> oidcMergeAccounts)
- if err := s.migrateOidcKeyNames(ctx); err != nil {
- slog.WarnContext(ctx, "Failed to migrate OIDC key names", "error", err)
- // Continue with JSON migration even if key rename fails
- }
-
- // Check if migration is needed: if we have authOidcConfig but no oidcClientId
- if currentSettings.AuthOidcConfig.Value == "" || currentSettings.AuthOidcConfig.Value == "{}" {
- slog.DebugContext(ctx, "No OIDC config to migrate")
- return nil
- }
-
- // If individual fields are already populated, skip migration
- if currentSettings.OidcClientId.Value != "" {
- slog.DebugContext(ctx, "OIDC fields already populated, skipping migration")
- return nil
- }
-
- var oidcConfig models.OidcConfig
- if err := json.Unmarshal([]byte(currentSettings.AuthOidcConfig.Value), &oidcConfig); err != nil {
- slog.WarnContext(ctx, "Failed to parse legacy OIDC config for migration", "error", err)
- return nil
- }
-
- // Only migrate if there's actual data
- if oidcConfig.ClientID == "" && oidcConfig.IssuerURL == "" {
- slog.DebugContext(ctx, "Legacy OIDC config is empty, skipping migration")
- return nil
- }
-
- slog.InfoContext(ctx, "Migrating legacy OIDC config to individual fields")
-
- scopes := oidcConfig.Scopes
- if scopes == "" {
- scopes = "openid email profile"
- }
-
- _, err = s.UpdateSettings(ctx, settings.Update{
- OidcClientId: new(oidcConfig.ClientID),
- OidcClientSecret: new(oidcConfig.ClientSecret),
- OidcIssuerUrl: new(oidcConfig.IssuerURL),
- OidcScopes: new(scopes),
- OidcAdminClaim: new(oidcConfig.AdminClaim),
- OidcAdminValue: new(oidcConfig.AdminValue),
- })
- if err != nil {
- return fmt.Errorf("failed to migrate OIDC config: %w", err)
- }
-
- slog.InfoContext(ctx, "Successfully migrated OIDC config to individual fields")
- return nil
-}
-
-// migrateOidcKeyNames renames legacy authOidc* keys to new oidc* keys in the database.
-func (s *SettingsService) migrateOidcKeyNames(ctx context.Context) error {
- keyMappings := map[string]string{
- "authOidcEnabled": "oidcEnabled",
- "authOidcMergeAccounts": "oidcMergeAccounts",
- "authOidcClientId": "oidcClientId",
- "authOidcClientSecret": "oidcClientSecret",
- "authOidcIssuerUrl": "oidcIssuerUrl",
- "authOidcScopes": "oidcScopes",
- "authOidcAdminClaim": "oidcAdminClaim",
- "authOidcAdminValue": "oidcAdminValue",
- }
-
- return s.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
- for oldKey, newKey := range keyMappings {
- // Check if old key exists
- var oldSetting models.SettingVariable
- if err := tx.Where("key = ?", oldKey).First(&oldSetting).Error; err != nil {
- if errors.Is(err, gorm.ErrRecordNotFound) {
- continue // Old key doesn't exist, nothing to migrate
- }
- return fmt.Errorf("failed to check old key %s: %w", oldKey, err)
- }
-
- // Check if new key already exists
- var newSetting models.SettingVariable
- if err := tx.Where("key = ?", newKey).First(&newSetting).Error; err == nil {
- // New key already exists, delete the old one
- if err := tx.Delete(&oldSetting).Error; err != nil {
- return fmt.Errorf("failed to delete old key %s: %w", oldKey, err)
- }
- slog.DebugContext(ctx, "Deleted duplicate legacy key", "oldKey", oldKey, "newKey", newKey)
- continue
- }
-
- // Rename: update key from old to new
- if err := tx.Model(&oldSetting).Update("key", newKey).Error; err != nil {
- return fmt.Errorf("failed to rename key %s to %s: %w", oldKey, newKey, err)
- }
- slog.InfoContext(ctx, "Migrated OIDC setting key", "oldKey", oldKey, "newKey", newKey)
- }
- return nil
- })
-}
-
func (s *SettingsService) UpdateSetting(ctx context.Context, key, value string) error {
if err := s.updateSettingValueNoRefreshInternal(ctx, key, value); err != nil {
return err
@@ -799,12 +529,7 @@ func (s *SettingsService) prepareUpdateValues(updates settings.Update, cfg, defa
case "autoUpdate", "autoUpdateInterval":
changedAutoUpdate = true
case "scheduledPruneEnabled",
- "scheduledPruneInterval",
- "scheduledPruneContainers",
- "scheduledPruneImages",
- "scheduledPruneVolumes",
- "scheduledPruneNetworks",
- "scheduledPruneBuildCache":
+ "scheduledPruneInterval":
changedScheduledPrune = true
case "vulnerabilityScanEnabled", "vulnerabilityScanInterval", "trivyNetwork", "trivySecurityOpts", "trivyPrivileged", "trivyResourceLimitsEnabled", "trivyCpuLimit", "trivyMemoryLimitMb", "trivyConcurrentScanContainers":
changedVulnerabilityScan = true
@@ -850,38 +575,6 @@ func (s *SettingsService) persistSettings(ctx context.Context, values []models.S
}
func (s *SettingsService) handleOidcConfigUpdate(ctx context.Context, updates settings.Update) error {
- // Handle legacy JSON config format (for backward compatibility during migration)
- if updates.AuthOidcConfig != nil {
- newCfgStr := *updates.AuthOidcConfig
- var incoming models.OidcConfig
- if err := json.Unmarshal([]byte(newCfgStr), &incoming); err != nil {
- return fmt.Errorf("invalid authOidcConfig JSON: %w", err)
- }
-
- current, err := s.GetSettings(ctx)
- if err != nil {
- return fmt.Errorf("failed to load current settings: %w", err)
- }
-
- if current.AuthOidcConfig.Value != "" {
- var existing models.OidcConfig
- if err := json.Unmarshal([]byte(current.AuthOidcConfig.Value), &existing); err == nil {
- if incoming.ClientSecret == "" {
- incoming.ClientSecret = existing.ClientSecret
- }
- }
- }
-
- mergedBytes, err := incoming.MarshalDocument()
- if err != nil {
- return fmt.Errorf("failed to marshal merged OIDC config: %w", err)
- }
-
- if err := s.updateSettingValueNoRefreshInternal(ctx, "authOidcConfig", string(mergedBytes)); err != nil {
- return fmt.Errorf("failed to update authOidcConfig: %w", err)
- }
- }
-
// Handle new individual field for client secret (sensitive field)
if updates.OidcClientSecret != nil {
secret := *updates.OidcClientSecret
diff --git a/backend/internal/services/settings_service_test.go b/backend/internal/services/settings_service_test.go
index 75f71fae3..cb80a4d16 100644
--- a/backend/internal/services/settings_service_test.go
+++ b/backend/internal/services/settings_service_test.go
@@ -2,7 +2,6 @@ package services
import (
"context"
- "encoding/json"
"path/filepath"
"testing"
@@ -129,80 +128,6 @@ func TestSettingsService_GetSettings_UsesCachedSnapshotWithoutDatabase(t *testin
require.Equal(t, "http://cached", settings.BaseServerURL.Value)
}
-func TestSettingsService_LoadDatabaseSettings_MigratesLegacyPruneSettings(t *testing.T) {
- ctx := context.Background()
- t.Setenv("UI_CONFIGURATION_DISABLED", "false")
- t.Setenv("AGENT_MODE", "false")
- t.Setenv("EDGE_AGENT", "false")
-
- tests := []struct {
- name string
- legacy []models.SettingVariable
- assertCfg func(t *testing.T, cfg *models.Settings)
- }{
- {
- name: "maps all prune mode to aggressive resource modes",
- legacy: []models.SettingVariable{
- {Key: "dockerPruneMode", Value: "all"},
- {Key: "scheduledPruneContainers", Value: "true"},
- {Key: "scheduledPruneImages", Value: "true"},
- {Key: "scheduledPruneVolumes", Value: "true"},
- {Key: "scheduledPruneNetworks", Value: "true"},
- {Key: "scheduledPruneBuildCache", Value: "true"},
- },
- assertCfg: func(t *testing.T, cfg *models.Settings) {
- require.Equal(t, "stopped", cfg.PruneContainerMode.Value)
- require.Equal(t, "all", cfg.PruneImageMode.Value)
- require.Equal(t, "all", cfg.PruneVolumeMode.Value)
- require.Equal(t, "unused", cfg.PruneNetworkMode.Value)
- require.Equal(t, "all", cfg.PruneBuildCacheMode.Value)
- },
- },
- {
- name: "uses dangling defaults when legacy booleans are missing",
- legacy: []models.SettingVariable{
- {Key: "dockerPruneMode", Value: "dangling"},
- },
- assertCfg: func(t *testing.T, cfg *models.Settings) {
- require.Equal(t, "stopped", cfg.PruneContainerMode.Value)
- require.Equal(t, "dangling", cfg.PruneImageMode.Value)
- require.Equal(t, "none", cfg.PruneVolumeMode.Value)
- require.Equal(t, "unused", cfg.PruneNetworkMode.Value)
- require.Equal(t, "none", cfg.PruneBuildCacheMode.Value)
- },
- },
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- db := setupSettingsTestDB(t)
- require.NoError(t, db.DB.Create(&tt.legacy).Error)
-
- svc := &SettingsService{db: db}
- cfg, err := svc.loadDatabaseSettingsInternal(ctx, db)
- require.NoError(t, err)
-
- tt.assertCfg(t, cfg)
-
- for _, key := range []string{
- "pruneContainerMode",
- "pruneContainerUntil",
- "pruneImageMode",
- "pruneImageUntil",
- "pruneVolumeMode",
- "pruneNetworkMode",
- "pruneNetworkUntil",
- "pruneBuildCacheMode",
- "pruneBuildCacheUntil",
- } {
- var setting models.SettingVariable
- err := db.DB.Where("key = ?", key).First(&setting).Error
- require.NoErrorf(t, err, "expected migrated key %s to be persisted", key)
- }
- })
- }
-}
-
func TestSettingsService_PruneUnknownSettings_RemovesStaleKeys(t *testing.T) {
ctx := context.Background()
db := setupSettingsTestDB(t)
@@ -489,44 +414,6 @@ func TestSettingsService_EnsureEncryptionKey(t *testing.T) {
require.Equal(t, k1, sv.Value)
}
-func TestSettingsService_UpdateSettings_MergeOidcSecret(t *testing.T) {
- ctx := context.Background()
- db := setupSettingsTestDB(t)
- svc, err := NewSettingsService(ctx, db)
- require.NoError(t, err)
-
- // Seed existing OIDC config with a secret
- existing := models.OidcConfig{
- ClientID: "old",
- ClientSecret: "keep-this",
- IssuerURL: "https://issuer",
- }
- b, err := json.Marshal(existing)
- require.NoError(t, err)
- require.NoError(t, svc.UpdateSetting(ctx, "authOidcConfig", string(b)))
-
- // Incoming update missing clientSecret should preserve existing one
- incoming := models.OidcConfig{
- ClientID: "new",
- IssuerURL: "https://issuer",
- }
- nb, err := json.Marshal(incoming)
- require.NoError(t, err)
- updates := settings.Update{
- AuthOidcConfig: new(string(nb)),
- }
- _, err = svc.UpdateSettings(ctx, updates)
- require.NoError(t, err)
-
- var cfgVar models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "authOidcConfig").First(&cfgVar).Error)
-
- var merged models.OidcConfig
- require.NoError(t, json.Unmarshal([]byte(cfgVar.Value), &merged))
- require.Equal(t, "new", merged.ClientID)
- require.Equal(t, "keep-this", merged.ClientSecret)
-}
-
func TestSettingsService_LoadDatabaseSettings_ReloadsChanges(t *testing.T) {
ctx := context.Background()
db := setupSettingsTestDB(t)
@@ -833,183 +720,6 @@ func TestSettingsService_LoadDatabaseSettings_InternalKeys_EnvMode(t *testing.T)
require.Equal(t, internalVal, cfg.InstanceID.Value)
}
-func TestSettingsService_MigrateOidcConfigToFields(t *testing.T) {
- ctx := context.Background()
- db := setupSettingsTestDB(t)
- svc, err := NewSettingsService(ctx, db)
- require.NoError(t, err)
- require.NoError(t, svc.EnsureDefaultSettings(ctx))
-
- // Seed legacy OIDC JSON config
- legacyConfig := models.OidcConfig{
- ClientID: "legacy-client-id",
- ClientSecret: "legacy-secret",
- IssuerURL: "https://legacy-issuer.example",
- Scopes: "openid email profile",
- AdminClaim: "groups",
- AdminValue: "admin",
- }
- b, err := json.Marshal(legacyConfig)
- require.NoError(t, err)
- require.NoError(t, svc.UpdateSetting(ctx, "authOidcConfig", string(b)))
-
- // Run migration
- err = svc.MigrateOidcConfigToFields(ctx)
- require.NoError(t, err)
-
- // Verify individual fields were populated
- var clientId models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcClientId").First(&clientId).Error)
- require.Equal(t, "legacy-client-id", clientId.Value)
-
- var clientSecret models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcClientSecret").First(&clientSecret).Error)
- require.Equal(t, "legacy-secret", clientSecret.Value)
-
- var issuerUrl models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcIssuerUrl").First(&issuerUrl).Error)
- require.Equal(t, "https://legacy-issuer.example", issuerUrl.Value)
-
- var scopes models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcScopes").First(&scopes).Error)
- require.Equal(t, "openid email profile", scopes.Value)
-
- var adminClaim models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcAdminClaim").First(&adminClaim).Error)
- require.Equal(t, "groups", adminClaim.Value)
-
- var adminValue models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcAdminValue").First(&adminValue).Error)
- require.Equal(t, "admin", adminValue.Value)
-}
-
-func TestSettingsService_MigrateOidcConfigToFields_SkipsIfAlreadyMigrated(t *testing.T) {
- ctx := context.Background()
- db := setupSettingsTestDB(t)
- svc, err := NewSettingsService(ctx, db)
- require.NoError(t, err)
- require.NoError(t, svc.EnsureDefaultSettings(ctx))
-
- // Pre-populate individual field
- require.NoError(t, svc.UpdateSetting(ctx, "oidcClientId", "already-migrated"))
-
- // Seed legacy config too
- legacyConfig := models.OidcConfig{
- ClientID: "old-id",
- IssuerURL: "https://old-issuer.example",
- }
- b, err := json.Marshal(legacyConfig)
- require.NoError(t, err)
- require.NoError(t, svc.UpdateSetting(ctx, "authOidcConfig", string(b)))
-
- // Run migration - should skip since individual field is populated
- err = svc.MigrateOidcConfigToFields(ctx)
- require.NoError(t, err)
-
- // Verify field was NOT overwritten
- var clientId models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcClientId").First(&clientId).Error)
- require.Equal(t, "already-migrated", clientId.Value)
-}
-
-func TestSettingsService_MigrateOidcConfigToFields_RealWorldJSON(t *testing.T) {
- ctx := context.Background()
- db := setupSettingsTestDB(t)
- svc, err := NewSettingsService(ctx, db)
- require.NoError(t, err)
- require.NoError(t, svc.EnsureDefaultSettings(ctx))
-
- // Test with real-world JSON format (as stored in database)
- realWorldJSON := `{"clientId":"ab92b6cf-283d-4764-9308-92a9b9496bf1","clientSecret":"super-secret-value","issuerUrl":"https://id.ofkm.us","scopes":"openid email profile groups","adminClaim":"groups","adminValue":"_arcane_admins"}`
- require.NoError(t, svc.UpdateSetting(ctx, "authOidcConfig", realWorldJSON))
-
- // Run migration
- err = svc.MigrateOidcConfigToFields(ctx)
- require.NoError(t, err)
-
- // Verify all individual fields were populated correctly
- var clientId models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcClientId").First(&clientId).Error)
- require.Equal(t, "ab92b6cf-283d-4764-9308-92a9b9496bf1", clientId.Value)
-
- var clientSecret models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcClientSecret").First(&clientSecret).Error)
- require.Equal(t, "super-secret-value", clientSecret.Value)
-
- var issuerUrl models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcIssuerUrl").First(&issuerUrl).Error)
- require.Equal(t, "https://id.ofkm.us", issuerUrl.Value)
-
- var scopes models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcScopes").First(&scopes).Error)
- require.Equal(t, "openid email profile groups", scopes.Value)
-
- var adminClaim models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcAdminClaim").First(&adminClaim).Error)
- require.Equal(t, "groups", adminClaim.Value)
-
- var adminValue models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcAdminValue").First(&adminValue).Error)
- require.Equal(t, "_arcane_admins", adminValue.Value)
-}
-
-func TestSettingsService_MigrateOidcConfigToFields_EmptyConfig(t *testing.T) {
- ctx := context.Background()
- db := setupSettingsTestDB(t)
- svc, err := NewSettingsService(ctx, db)
- require.NoError(t, err)
- require.NoError(t, svc.EnsureDefaultSettings(ctx))
-
- // Empty config should not cause errors
- require.NoError(t, svc.UpdateSetting(ctx, "authOidcConfig", "{}"))
-
- err = svc.MigrateOidcConfigToFields(ctx)
- require.NoError(t, err)
-
- // Verify fields remain empty
- var clientId models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcClientId").First(&clientId).Error)
- require.Empty(t, clientId.Value)
-}
-
-func TestSettingsService_MigrateOidcConfigToFields_InvalidJSON(t *testing.T) {
- ctx := context.Background()
- db := setupSettingsTestDB(t)
- svc, err := NewSettingsService(ctx, db)
- require.NoError(t, err)
- require.NoError(t, svc.EnsureDefaultSettings(ctx))
-
- // Invalid JSON should not cause errors (gracefully handled)
- require.NoError(t, svc.UpdateSetting(ctx, "authOidcConfig", "not valid json"))
-
- err = svc.MigrateOidcConfigToFields(ctx)
- require.NoError(t, err) // Should not return error, just skip
-
- // Verify fields remain empty
- var clientId models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcClientId").First(&clientId).Error)
- require.Empty(t, clientId.Value)
-}
-
-func TestSettingsService_MigrateOidcConfigToFields_DefaultScopes(t *testing.T) {
- ctx := context.Background()
- db := setupSettingsTestDB(t)
- svc, err := NewSettingsService(ctx, db)
- require.NoError(t, err)
- require.NoError(t, svc.EnsureDefaultSettings(ctx))
-
- // Config without scopes should get default scopes
- configWithoutScopes := `{"clientId":"test-client","issuerUrl":"https://test.example"}`
- require.NoError(t, svc.UpdateSetting(ctx, "authOidcConfig", configWithoutScopes))
-
- err = svc.MigrateOidcConfigToFields(ctx)
- require.NoError(t, err)
-
- var scopes models.SettingVariable
- require.NoError(t, svc.db.WithContext(ctx).Where("key = ?", "oidcScopes").First(&scopes).Error)
- require.Equal(t, "openid email profile", scopes.Value)
-}
-
func TestSettingsService_NormalizeProjectsDirectory_ConvertsRelativeToAbsolute(t *testing.T) {
ctx := context.Background()
db := setupSettingsTestDB(t)
diff --git a/backend/pkg/dockerutil/jsonstream.go b/backend/pkg/dockerutil/jsonstream.go
index 7612273ec..482850870 100644
--- a/backend/pkg/dockerutil/jsonstream.go
+++ b/backend/pkg/dockerutil/jsonstream.go
@@ -3,9 +3,7 @@ package docker
import (
"bufio"
"encoding/json"
- "errors"
"io"
- "strings"
"github.com/moby/moby/api/types/jsonstream"
)
@@ -32,14 +30,6 @@ func ConsumeJSONMessageStream(reader io.Reader, lineHandler func([]byte) error)
if msg.Error != nil {
return msg.Error
}
-
- // Some daemons include an additional top-level "error" string.
- var legacy struct {
- Error string `json:"error,omitempty"`
- }
- if err := json.Unmarshal(line, &legacy); err == nil && strings.TrimSpace(legacy.Error) != "" {
- return errors.New(strings.TrimSpace(legacy.Error))
- }
}
if err := scanner.Err(); err != nil {
diff --git a/backend/pkg/dockerutil/jsonstream_test.go b/backend/pkg/dockerutil/jsonstream_test.go
index 6766fd9d8..783a6a552 100644
--- a/backend/pkg/dockerutil/jsonstream_test.go
+++ b/backend/pkg/dockerutil/jsonstream_test.go
@@ -30,11 +30,4 @@ func TestConsumeJSONMessageStream(t *testing.T) {
}
})
- t.Run("returns legacy top-level error string", func(t *testing.T) {
- stream := strings.NewReader(`{"error":"manifest unknown"}` + "\n")
- err := ConsumeJSONMessageStream(stream, nil)
- if err == nil || !strings.Contains(err.Error(), "manifest unknown") {
- t.Fatalf("expected manifest unknown error, got %v", err)
- }
- })
}
diff --git a/backend/pkg/libarcane/edge/client_grpc_test.go b/backend/pkg/libarcane/edge/client_grpc_test.go
index 94c4fa671..68a546441 100644
--- a/backend/pkg/libarcane/edge/client_grpc_test.go
+++ b/backend/pkg/libarcane/edge/client_grpc_test.go
@@ -574,97 +574,7 @@ func TestTunnelClient_connectAndServe_WebSocketConfigFallsBackToWebSocket(t *tes
}
}
-func TestTunnelClient_connectAndServe_AutoTransportFallsBackToWebSocketWhenGRPCUnavailable(t *testing.T) {
- ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
- defer cancel()
-
- wsConnectedCh := make(chan struct{}, 1)
- managerServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if r.URL.Path != "/api/tunnel/connect" {
- http.NotFound(w, r)
- return
- }
-
- upgrader := websocket.Upgrader{}
- conn, err := upgrader.Upgrade(w, r, nil)
- if err != nil {
- return
- }
- defer func() { _ = conn.Close() }()
-
- select {
- case wsConnectedCh <- struct{}{}:
- default:
- }
-
- time.Sleep(100 * time.Millisecond)
- }))
- defer managerServer.Close()
-
- cfg := &Config{
- EdgeTransport: EdgeTransportAuto,
- ManagerApiUrl: managerServer.URL,
- AgentToken: "valid-token",
- }
-
- client := NewTunnelClient(cfg, http.NotFoundHandler())
- err := client.connectAndServe(ctx)
- require.Error(t, err)
-
- select {
- case <-wsConnectedCh:
- case <-time.After(2 * time.Second):
- t.Fatal("expected auto transport to fall back to websocket")
- }
-}
-
-func TestTunnelClient_connectAndServe_AutoTransportDerivesWebSocketFallbackURL(t *testing.T) {
- ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
- defer cancel()
-
- wsConnectedCh := make(chan struct{}, 1)
- managerServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if r.URL.Path != "/api/tunnel/connect" {
- http.NotFound(w, r)
- return
- }
-
- upgrader := websocket.Upgrader{}
- conn, err := upgrader.Upgrade(w, r, nil)
- if err != nil {
- return
- }
- defer func() { _ = conn.Close() }()
-
- select {
- case wsConnectedCh <- struct{}{}:
- default:
- }
-
- time.Sleep(100 * time.Millisecond)
- }))
- defer managerServer.Close()
-
- cfg := &Config{
- EdgeTransport: EdgeTransportAuto,
- ManagerApiUrl: managerServer.URL,
- AgentToken: "valid-token",
- }
-
- client := NewTunnelClient(cfg, http.NotFoundHandler())
- client.managerURL = ""
-
- err := client.connectAndServe(ctx)
- require.Error(t, err)
-
- select {
- case <-wsConnectedCh:
- case <-time.After(2 * time.Second):
- t.Fatal("expected auto transport to derive websocket fallback URL")
- }
-}
-
-func TestTunnelClient_connectAndServe_AutoTransportOpensGRPCWhenAvailable(t *testing.T) {
+func TestTunnelClient_connectAndServe_OpensGRPCWhenAvailable(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
defer cancel()
@@ -687,7 +597,7 @@ func TestTunnelClient_connectAndServe_AutoTransportOpensGRPCWhenAvailable(t *tes
defer stopManager()
client := NewTunnelClient(&Config{
- EdgeTransport: EdgeTransportAuto,
+ EdgeTransport: EdgeTransportGRPC,
ManagerApiUrl: managerURL,
AgentToken: "valid-token",
}, http.NotFoundHandler())
diff --git a/backend/pkg/libarcane/edge/commands.go b/backend/pkg/libarcane/edge/commands.go
index de82f682a..54a83df86 100644
--- a/backend/pkg/libarcane/edge/commands.go
+++ b/backend/pkg/libarcane/edge/commands.go
@@ -144,9 +144,6 @@ var commandRoutes = []commandRoute{
{Method: http.MethodPost, PathPattern: "/api/environments/{id}/notifications/settings", CommandName: "notification.settings.upsert"},
{Method: http.MethodDelete, PathPattern: "/api/environments/{id}/notifications/settings/{provider}", CommandName: "notification.settings.delete"},
{Method: http.MethodPost, PathPattern: "/api/environments/{id}/notifications/test/{provider}", CommandName: "notification.test"},
- {Method: http.MethodGet, PathPattern: "/api/environments/{id}/notifications/apprise", CommandName: "notification.apprise.get"},
- {Method: http.MethodPost, PathPattern: "/api/environments/{id}/notifications/apprise", CommandName: "notification.apprise.upsert"},
- {Method: http.MethodPost, PathPattern: "/api/environments/{id}/notifications/apprise/test", CommandName: "notification.apprise.test"},
{Method: http.MethodGet, PathPattern: "/api/environments/{id}/dashboard", CommandName: "dashboard.snapshot"},
{Method: http.MethodGet, PathPattern: "/api/environments/{id}/dashboard/action-items", CommandName: "dashboard.action_items"},
diff --git a/backend/pkg/libarcane/edge/registry.go b/backend/pkg/libarcane/edge/registry.go
index 25cf9fefe..62bfb6c05 100644
--- a/backend/pkg/libarcane/edge/registry.go
+++ b/backend/pkg/libarcane/edge/registry.go
@@ -122,9 +122,8 @@ func (r *TunnelRegistry) RegisterSession(tunnel *AgentTunnel, staleAfter time.Du
existingStale := staleAfter > 0 && time.Since(existing.GetLastHeartbeat()) > staleAfter
sameAgentInstance := existing.AgentInstance != "" && tunnel.AgentInstance != "" && existing.AgentInstance == tunnel.AgentInstance
- legacyReplace := existing.AgentInstance == "" || tunnel.AgentInstance == ""
- if existing.Conn == nil || existing.Conn.IsClosed() || existingStale || sameAgentInstance || legacyReplace {
+ if existing.Conn == nil || existing.Conn.IsClosed() || existingStale || sameAgentInstance {
if sameAgentInstance {
drainPrevious = true
}
diff --git a/backend/pkg/libarcane/edge/tls.go b/backend/pkg/libarcane/edge/tls.go
index 99cdd2a3a..cecfa8f87 100644
--- a/backend/pkg/libarcane/edge/tls.go
+++ b/backend/pkg/libarcane/edge/tls.go
@@ -715,9 +715,6 @@ func ensureManagerCAInternal(ctx context.Context, assetsDir string) (string, str
caCertPath := filepath.Join(assetsDir, generatedMTLSCACertFileName)
caKeyPath := filepath.Join(assetsDir, generatedMTLSCAKeyFileName)
if generatedCAReadyInternal(caCertPath, caKeyPath) {
- if err := migratePlainCAKeyInternal(caKeyPath); err != nil {
- return "", "", false, err
- }
return caCertPath, caKeyPath, false, nil
}
_ = os.Remove(caCertPath)
@@ -763,25 +760,6 @@ func generatedCAReadyInternal(caCertPath string, caKeyPath string) bool {
return true
}
-func migratePlainCAKeyInternal(caKeyPath string) error {
- if isCAKeyEncryptedOnDiskInternal(caKeyPath) {
- return nil
- }
- keyPEM, err := os.ReadFile(caKeyPath)
- if err != nil {
- return fmt.Errorf("failed to read legacy plain edge mTLS CA key for migration: %w", err)
- }
- block, _ := pem.Decode(keyPEM)
- if block == nil {
- return fmt.Errorf("failed to decode legacy plain edge mTLS CA key for migration")
- }
- if err := writeCAKeyFileInternal(caKeyPath, block.Bytes); err != nil {
- return fmt.Errorf("failed to migrate edge mTLS CA key to encrypted format: %w", err)
- }
- slog.Info("migrated edge mTLS CA key to encrypted format", "path", caKeyPath)
- return nil
-}
-
func ensureClientCertificateInternal(ctx context.Context, assetsDir string, envID string, envName string, appURL string) (string, string, bool, error) {
caCertPath, caKeyPath, _, err := ensureManagerCAInternal(ctx, assetsDir)
if err != nil {
@@ -1231,9 +1209,7 @@ const caKeyEncryptedPrefix = "ARCANE-ENC-V1:"
var caKeyEncryptInternal = libcrypto.Encrypt
// writeCAKeyFileInternal writes the edge CA private key to disk using envelope
-// encryption via libcrypto. The on-disk format is self-describing so
-// readCAKeyPEMInternal can transparently handle encrypted files and legacy
-// plaintext files.
+// encryption via libcrypto.
func writeCAKeyFileInternal(path string, derBytes []byte) error {
pemBytes := pem.EncodeToMemory(&pem.Block{Type: "EC PRIVATE KEY", Bytes: derBytes})
if pemBytes == nil {
@@ -1252,36 +1228,22 @@ func writeCAKeyFileInternal(path string, derBytes []byte) error {
}
// readCAKeyPEMInternal returns the plain PEM bytes of the edge CA private key,
-// accepting either the legacy plain PEM file or a libcrypto-envelope-encrypted
-// file written by writeCAKeyFileInternal.
+// reading a libcrypto-envelope-encrypted file written by writeCAKeyFileInternal.
func readCAKeyPEMInternal(path string) ([]byte, error) {
raw, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("failed to read CA private key %s: %w", path, err)
}
trimmed := strings.TrimSpace(string(raw))
- if strings.HasPrefix(trimmed, caKeyEncryptedPrefix) {
- ciphertext := strings.TrimPrefix(trimmed, caKeyEncryptedPrefix)
- plaintext, err := libcrypto.Decrypt(ciphertext)
- if err != nil {
- return nil, fmt.Errorf("failed to decrypt CA private key %s: %w", path, err)
- }
- return []byte(plaintext), nil
+ if !strings.HasPrefix(trimmed, caKeyEncryptedPrefix) {
+ return nil, fmt.Errorf("CA private key %s is not in the expected encrypted envelope format", path)
}
- return raw, nil
-}
-
-// isCAKeyEncryptedOnDiskInternal reports whether the given CA key file is
-// stored in the libcrypto envelope format.
-func isCAKeyEncryptedOnDiskInternal(path string) bool {
- f, err := os.Open(path)
+ ciphertext := strings.TrimPrefix(trimmed, caKeyEncryptedPrefix)
+ plaintext, err := libcrypto.Decrypt(ciphertext)
if err != nil {
- return false
+ return nil, fmt.Errorf("failed to decrypt CA private key %s: %w", path, err)
}
- defer func() { _ = f.Close() }()
- head := make([]byte, len(caKeyEncryptedPrefix))
- n, _ := io.ReadFull(f, head)
- return n == len(caKeyEncryptedPrefix) && string(head) == caKeyEncryptedPrefix
+ return []byte(plaintext), nil
}
// writeFileAtomicInternal writes data to path via a temp file + rename.
diff --git a/backend/pkg/libarcane/edge/tls_test.go b/backend/pkg/libarcane/edge/tls_test.go
index babe5ee41..626faddad 100644
--- a/backend/pkg/libarcane/edge/tls_test.go
+++ b/backend/pkg/libarcane/edge/tls_test.go
@@ -488,9 +488,6 @@ func TestCAKey_EncryptedOnDiskWhenCryptoInitialized(t *testing.T) {
require.FileExists(t, caCertPath)
require.FileExists(t, caKeyPath)
- require.True(t, isCAKeyEncryptedOnDiskInternal(caKeyPath),
- "CA key file must be stored in the encrypted envelope format when libcrypto is initialized")
-
raw, err := os.ReadFile(caKeyPath)
require.NoError(t, err)
require.False(t, strings.Contains(string(raw), "BEGIN EC PRIVATE KEY"),
@@ -509,49 +506,6 @@ func TestCAKey_EncryptedOnDiskWhenCryptoInitialized(t *testing.T) {
require.FileExists(t, clientKeyPath)
}
-func TestCAKey_MigratesLegacyPlainFile(t *testing.T) {
- initEdgeTestCrypto(t)
-
- assetsDir := t.TempDir()
- _, caKeyPath, _, err := ensureManagerCAInternal(context.Background(), assetsDir)
- require.NoError(t, err)
-
- pemBytes, err := readCAKeyPEMInternal(caKeyPath)
- require.NoError(t, err)
- require.NoError(t, os.WriteFile(caKeyPath, pemBytes, 0o600))
- require.False(t, isCAKeyEncryptedOnDiskInternal(caKeyPath))
-
- _, caKeyPath2, _, err := ensureManagerCAInternal(context.Background(), assetsDir)
- require.NoError(t, err)
- require.Equal(t, caKeyPath, caKeyPath2)
- require.True(t, isCAKeyEncryptedOnDiskInternal(caKeyPath),
- "legacy plain CA key file must be migrated to the encrypted envelope format on next load")
-}
-
-func TestCAKey_LegacyPlainMigrationFailureReturnsError(t *testing.T) {
- initEdgeTestCrypto(t)
-
- assetsDir := t.TempDir()
- _, caKeyPath, _, err := ensureManagerCAInternal(context.Background(), assetsDir)
- require.NoError(t, err)
-
- pemBytes, err := readCAKeyPEMInternal(caKeyPath)
- require.NoError(t, err)
- require.NoError(t, os.WriteFile(caKeyPath, pemBytes, 0o600))
-
- originalEncrypt := caKeyEncryptInternal
- t.Cleanup(func() {
- caKeyEncryptInternal = originalEncrypt
- })
- caKeyEncryptInternal = func(string) (string, error) {
- return "", errors.New("encrypt failed")
- }
-
- _, _, _, err = ensureManagerCAInternal(context.Background(), assetsDir)
- require.Error(t, err)
- require.Contains(t, err.Error(), "failed to migrate edge mTLS CA key to encrypted format")
-}
-
func TestCAKey_EncryptionFailureReturnsError(t *testing.T) {
originalEncrypt := caKeyEncryptInternal
t.Cleanup(func() {
diff --git a/backend/pkg/libarcane/edge/transport.go b/backend/pkg/libarcane/edge/transport.go
index e5fac62c6..11a96a84a 100644
--- a/backend/pkg/libarcane/edge/transport.go
+++ b/backend/pkg/libarcane/edge/transport.go
@@ -84,9 +84,6 @@ const (
// EdgeTransportPoll uses an HTTP polling control plane with the existing
// websocket tunnel as an on-demand data plane.
EdgeTransportPoll = "poll"
- // EdgeTransportAuto preserves the legacy managed tunnel behavior: try gRPC
- // first and fall back to websocket when available.
- EdgeTransportAuto = "auto"
// EdgeMTLSModeDisabled disables edge tunnel mTLS.
EdgeMTLSModeDisabled = "disabled"
@@ -97,8 +94,7 @@ const (
EdgeMTLSModeRequired = "required"
)
-// NormalizeEdgeTransport normalizes transport config and defaults to the legacy
-// managed tunnel auto mode for backwards compatibility.
+// NormalizeEdgeTransport normalizes transport config and defaults to gRPC.
func NormalizeEdgeTransport(value string) string {
switch strings.ToLower(strings.TrimSpace(value)) {
case EdgeTransportWebSocket:
@@ -107,10 +103,8 @@ func NormalizeEdgeTransport(value string) string {
return EdgeTransportGRPC
case EdgeTransportPoll:
return EdgeTransportPoll
- case EdgeTransportAuto:
- return EdgeTransportAuto
default:
- return EdgeTransportAuto
+ return EdgeTransportGRPC
}
}
@@ -131,8 +125,7 @@ func UseGRPCEdgeTransport(cfg *Config) bool {
if cfg == nil {
return false
}
- transport := NormalizeEdgeTransport(cfg.EdgeTransport)
- return transport == EdgeTransportGRPC || transport == EdgeTransportAuto
+ return NormalizeEdgeTransport(cfg.EdgeTransport) == EdgeTransportGRPC
}
// UseWebSocketEdgeTransport reports whether websocket managed tunnel mode is allowed.
@@ -140,8 +133,7 @@ func UseWebSocketEdgeTransport(cfg *Config) bool {
if cfg == nil {
return false
}
- transport := NormalizeEdgeTransport(cfg.EdgeTransport)
- return transport == EdgeTransportWebSocket || transport == EdgeTransportAuto
+ return NormalizeEdgeTransport(cfg.EdgeTransport) == EdgeTransportWebSocket
}
// UsePollEdgeTransport reports whether the Portainer-style polling control plane
diff --git a/backend/pkg/libarcane/edge/transport_test.go b/backend/pkg/libarcane/edge/transport_test.go
index 3e4b2e663..7f21a2afd 100644
--- a/backend/pkg/libarcane/edge/transport_test.go
+++ b/backend/pkg/libarcane/edge/transport_test.go
@@ -9,13 +9,12 @@ import (
)
func TestNormalizeEdgeTransport(t *testing.T) {
- assert.Equal(t, EdgeTransportAuto, NormalizeEdgeTransport(""))
+ assert.Equal(t, EdgeTransportGRPC, NormalizeEdgeTransport(""))
assert.Equal(t, EdgeTransportGRPC, NormalizeEdgeTransport("grpc"))
assert.Equal(t, EdgeTransportGRPC, NormalizeEdgeTransport("GRPC"))
assert.Equal(t, EdgeTransportPoll, NormalizeEdgeTransport("poll"))
assert.Equal(t, EdgeTransportWebSocket, NormalizeEdgeTransport("websocket"))
- assert.Equal(t, EdgeTransportAuto, NormalizeEdgeTransport("invalid"))
- assert.Equal(t, EdgeTransportAuto, NormalizeEdgeTransport("auto"))
+ assert.Equal(t, EdgeTransportGRPC, NormalizeEdgeTransport("invalid"))
}
func TestNormalizeEdgeMTLSMode(t *testing.T) {
@@ -29,14 +28,12 @@ func TestUseGRPCEdgeTransport(t *testing.T) {
assert.False(t, UseGRPCEdgeTransport(nil))
assert.True(t, UseGRPCEdgeTransport(&Config{EdgeTransport: "grpc"}))
assert.True(t, UseGRPCEdgeTransport(&Config{EdgeTransport: ""}))
- assert.True(t, UseGRPCEdgeTransport(&Config{EdgeTransport: "auto"}))
assert.False(t, UseGRPCEdgeTransport(&Config{EdgeTransport: "websocket"}))
}
func TestUseWebSocketEdgeTransport(t *testing.T) {
assert.False(t, UseWebSocketEdgeTransport(nil))
- assert.True(t, UseWebSocketEdgeTransport(&Config{EdgeTransport: ""}))
- assert.True(t, UseWebSocketEdgeTransport(&Config{EdgeTransport: "auto"}))
+ assert.False(t, UseWebSocketEdgeTransport(&Config{EdgeTransport: ""}))
assert.False(t, UseWebSocketEdgeTransport(&Config{EdgeTransport: "grpc"}))
assert.False(t, UseWebSocketEdgeTransport(&Config{EdgeTransport: "poll"}))
assert.True(t, UseWebSocketEdgeTransport(&Config{EdgeTransport: "websocket"}))
@@ -45,7 +42,6 @@ func TestUseWebSocketEdgeTransport(t *testing.T) {
func TestUsePollEdgeTransport(t *testing.T) {
assert.False(t, UsePollEdgeTransport(nil))
assert.False(t, UsePollEdgeTransport(&Config{EdgeTransport: ""}))
- assert.False(t, UsePollEdgeTransport(&Config{EdgeTransport: "auto"}))
assert.False(t, UsePollEdgeTransport(&Config{EdgeTransport: "grpc"}))
assert.False(t, UsePollEdgeTransport(&Config{EdgeTransport: "websocket"}))
assert.True(t, UsePollEdgeTransport(&Config{EdgeTransport: "poll"}))
diff --git a/backend/pkg/libarcane/internal_resource.go b/backend/pkg/libarcane/internal_resource.go
index e4aeb519c..89b401440 100644
--- a/backend/pkg/libarcane/internal_resource.go
+++ b/backend/pkg/libarcane/internal_resource.go
@@ -3,18 +3,14 @@ package libarcane
import "strings"
// Internal containers indicate containers used for arcanes utilties, ie: temp containers used for viewing files for volumes etc
-const (
- InternalResourceLabel = "com.getarcaneapp.internal.resource"
- // Deprecated - Legacy label. Use InternalResourceLabel instead.
- legacyInternalContainerLabel = "com.getarcaneapp.internal.container"
-)
+const InternalResourceLabel = "com.getarcaneapp.internal.resource"
func IsInternalContainer(labels map[string]string) bool {
if labels == nil {
return false
}
for k, v := range labels {
- if strings.EqualFold(k, InternalResourceLabel) || strings.EqualFold(k, legacyInternalContainerLabel) {
+ if strings.EqualFold(k, InternalResourceLabel) {
switch strings.TrimSpace(strings.ToLower(v)) {
case "true", "1", "yes", "on":
return true
diff --git a/backend/pkg/libarcane/startup/startup.go b/backend/pkg/libarcane/startup/startup.go
index eae84c7b9..3c246812d 100644
--- a/backend/pkg/libarcane/startup/startup.go
+++ b/backend/pkg/libarcane/startup/startup.go
@@ -2,11 +2,7 @@ package startup
import (
"context"
- "fmt"
"log/slog"
- "strconv"
- "strings"
- "time"
"github.com/getarcaneapp/arcane/backend/buildables"
)
@@ -50,11 +46,6 @@ type SettingsPruner interface {
PruneUnknownSettings(ctx context.Context) error
}
-type IntervalMigrationItem struct {
- ID string
- RawValue string
-}
-
func InitializeDefaultSettings(ctx context.Context, cfg *RuntimeConfig, settingsMgr SettingsManager) {
slog.InfoContext(ctx, "Ensuring default settings are initialized")
@@ -89,8 +80,6 @@ func InitializeNonAgentFeatures(
createAdminFunc func(context.Context) error,
reconcileDefaultAdminAPIKeyFunc func(context.Context) error,
autoLoginInitFunc func(context.Context) error,
- migrateOidcFunc func(context.Context) error,
- migrateDiscordFunc func(context.Context) error,
) {
if cfg.AgentMode {
return
@@ -109,20 +98,6 @@ func InitializeNonAgentFeatures(
if err := autoLoginInitFunc(ctx); err != nil {
slog.WarnContext(ctx, "Failed to initialize auto-login", "error", err.Error())
}
-
- // Migrate legacy OIDC JSON config to individual fields (runs before env sync)
- if migrateOidcFunc != nil {
- if err := migrateOidcFunc(ctx); err != nil {
- slog.WarnContext(ctx, "Failed to migrate OIDC config to individual fields", "error", err.Error())
- }
- }
-
- // Migrate legacy Discord webhookUrl to separate webhookId and token fields
- if migrateDiscordFunc != nil {
- if err := migrateDiscordFunc(ctx); err != nil {
- slog.WarnContext(ctx, "Failed to migrate Discord webhook config", "error", err.Error())
- }
- }
}
func InitializeAutoLogin(ctx context.Context, cfg *RuntimeConfig) {
@@ -132,331 +107,3 @@ func InitializeAutoLogin(ctx context.Context, cfg *RuntimeConfig) {
slog.WarnContext(ctx, "⚠️ AUTO-LOGIN IS ENABLED - This is a security risk! Do NOT use in production.", "username", cfg.AutoLoginUsername)
slog.WarnContext(ctx, "⚠️ Auto-login will automatically authenticate users without requiring credentials.")
}
-
-func MigrateSchedulerCronValues(
- ctx context.Context,
- getSettingFunc func(context.Context, string, string) string,
- updateSettingFunc func(context.Context, string, string) error,
- reloadFunc func(context.Context) error,
-) {
- migrations := []struct {
- key string
- defaultUnit time.Duration
- }{
- {key: "pollingInterval", defaultUnit: time.Minute},
- {key: "autoUpdateInterval", defaultUnit: time.Minute},
- {key: "scheduledPruneInterval", defaultUnit: time.Minute},
- {key: "environmentHealthInterval", defaultUnit: time.Minute},
- {key: "eventCleanupInterval", defaultUnit: time.Minute},
- {key: "expiredSessionsCleanupInterval", defaultUnit: time.Minute},
- }
-
- changed := false
- for _, item := range migrations {
- raw := strings.TrimSpace(getSettingFunc(ctx, item.key, ""))
- if raw == "" {
- continue
- }
-
- cronValue, shouldUpdate, warn := normalizeSchedulerValueToCron(raw, item.defaultUnit)
- if warn != "" {
- slog.WarnContext(ctx, warn, "key", item.key, "value", raw)
- }
- if !shouldUpdate {
- continue
- }
- if cronValue == "" || cronValue == raw {
- continue
- }
- if err := updateSettingFunc(ctx, item.key, cronValue); err != nil {
- slog.WarnContext(ctx, "Failed to migrate scheduler setting", "key", item.key, "error", err.Error())
- continue
- }
- slog.InfoContext(ctx, "Migrated scheduler setting to cron", "key", item.key, "value", cronValue)
- changed = true
- }
-
- if changed && reloadFunc != nil {
- if err := reloadFunc(ctx); err != nil {
- slog.WarnContext(ctx, "Failed to reload settings after scheduler migration", "error", err.Error())
- }
- }
-}
-
-func MigrateGitOpsSyncIntervals(
- ctx context.Context,
- listFunc func(context.Context) ([]IntervalMigrationItem, error),
- updateFunc func(context.Context, string, int) error,
-) {
- if listFunc == nil || updateFunc == nil {
- return
- }
-
- items, err := listFunc(ctx)
- if err != nil {
- slog.WarnContext(ctx, "Failed to load git sync intervals for migration", "error", err.Error())
- return
- }
-
- for _, item := range items {
- raw := strings.TrimSpace(item.RawValue)
- if raw == "" {
- continue
- }
- minutes, shouldUpdate, warn := normalizeSchedulerValueToMinutes(raw, time.Minute)
- if warn != "" {
- slog.WarnContext(ctx, warn, "syncId", item.ID, "value", raw)
- }
- if !shouldUpdate || minutes <= 0 {
- continue
- }
- if err := updateFunc(ctx, item.ID, minutes); err != nil {
- slog.WarnContext(ctx, "Failed to migrate git sync interval", "syncId", item.ID, "error", err.Error())
- continue
- }
- slog.InfoContext(ctx, "Migrated git sync interval", "syncId", item.ID, "minutes", minutes)
- }
-}
-
-func normalizeSchedulerValueToCron(raw string, defaultUnit time.Duration) (string, bool, string) {
- trimmed := strings.TrimSpace(raw)
- if trimmed == "" {
- return "", false, ""
- }
-
- if strings.HasPrefix(trimmed, "@") {
- return trimmed, false, ""
- }
-
- if strings.HasPrefix(trimmed, "CRON_TZ=") || strings.HasPrefix(trimmed, "TZ=") {
- parts := strings.Fields(trimmed)
- if len(parts) == 6 {
- return parts[0] + " 0 " + strings.Join(parts[1:], " "), true, ""
- }
- return trimmed, false, ""
- }
-
- fields := strings.Fields(trimmed)
- if len(fields) == 5 {
- return "0 " + trimmed, true, ""
- }
- if len(fields) >= 6 {
- return trimmed, false, ""
- }
-
- duration, ok := parseSchedulerDuration(trimmed, defaultUnit)
- if !ok {
- return "", false, ""
- }
-
- cronValue, warn := durationToCron(duration)
- if cronValue == "" {
- return "", false, warn
- }
-
- return cronValue, true, warn
-}
-
-func parseSchedulerDuration(raw string, defaultUnit time.Duration) (time.Duration, bool) {
- if raw == "" {
- return 0, false
- }
- if d, err := time.ParseDuration(raw); err == nil {
- return d, true
- }
- value, err := strconv.Atoi(raw)
- if err != nil {
- return 0, false
- }
- if defaultUnit <= 0 {
- defaultUnit = time.Minute
- }
- return time.Duration(value) * defaultUnit, true
-}
-
-func durationToCron(d time.Duration) (string, string) {
- if d <= 0 {
- return "", ""
- }
-
- if d < time.Minute {
- seconds := int(d.Seconds())
- if d%time.Second != 0 {
- seconds++
- }
- if seconds < 1 {
- return "", ""
- }
- if seconds >= 60 {
- minutes := (seconds + 59) / 60
- return minutesToCron(minutes), "scheduler interval rounded up to minutes"
- }
- return fmt.Sprintf("*/%d * * * * *", seconds), ""
- }
-
- if d%time.Minute != 0 {
- seconds := int(d.Seconds())
- if d%time.Second != 0 {
- seconds++
- }
- minutes := (seconds + 59) / 60
- return minutesToCron(minutes), "scheduler interval rounded up to minutes"
- }
-
- minutes := int(d.Minutes())
- return minutesToCron(minutes), ""
-}
-
-func minutesToCron(minutes int) string {
- if minutes <= 0 {
- return ""
- }
- if minutes < 60 {
- return fmt.Sprintf("0 */%d * * * *", minutes)
- }
- if minutes%60 == 0 {
- hours := minutes / 60
- if hours < 24 {
- return fmt.Sprintf("0 0 */%d * * *", hours)
- }
- if hours%24 == 0 {
- days := hours / 24
- return fmt.Sprintf("0 0 0 */%d * *", days)
- }
- }
- return fmt.Sprintf("0 */%d * * * *", minutes)
-}
-
-func normalizeSchedulerValueToMinutes(raw string, defaultUnit time.Duration) (int, bool, string) {
- trimmed := strings.TrimSpace(raw)
- if trimmed == "" {
- return 0, false, ""
- }
-
- if strings.HasPrefix(trimmed, "@") {
- return 0, false, ""
- }
-
- if strings.HasPrefix(trimmed, "CRON_TZ=") || strings.HasPrefix(trimmed, "TZ=") {
- parts := strings.Fields(trimmed)
- if len(parts) >= 6 {
- minutes, ok, warn := cronToMinutes(parts[1:])
- if ok {
- return minutes, true, warn
- }
- }
- return 0, false, ""
- }
-
- fields := strings.Fields(trimmed)
- if len(fields) >= 5 {
- if len(fields) == 5 {
- fields = append([]string{"0"}, fields...)
- }
- minutes, ok, warn := cronToMinutes(fields)
- if ok {
- return minutes, true, warn
- }
- return 0, false, ""
- }
-
- duration, ok := parseSchedulerDuration(trimmed, defaultUnit)
- if !ok {
- return 0, false, ""
- }
-
- minutes := int(duration / time.Minute)
- warn := ""
- if duration%time.Minute != 0 {
- minutes++
- warn = "scheduler interval rounded up to minutes"
- }
- if minutes < 1 {
- minutes = 1
- warn = "scheduler interval rounded up to minutes"
- }
- if strconv.Itoa(minutes) == trimmed {
- return minutes, false, warn
- }
-
- return minutes, true, warn
-}
-
-func cronToMinutes(fields []string) (int, bool, string) {
- if len(fields) < 6 {
- return 0, false, ""
- }
-
- sec, min, hour, day, month, weekday := fields[0], fields[1], fields[2], fields[3], fields[4], fields[5]
-
- if mins, ok, warn := tryConvertSecondStep(sec, min, hour, day, month, weekday); ok {
- return mins, ok, warn
- }
- if mins, ok, warn := tryConvertMinuteOrHour(sec, min, hour, day, month, weekday); ok {
- return mins, ok, warn
- }
- if mins, ok, warn := tryConvertDayStep(sec, min, hour, day, month, weekday); ok {
- return mins, ok, warn
- }
-
- return 0, false, ""
-}
-
-func tryConvertSecondStep(sec, min, hour, day, month, weekday string) (int, bool, string) {
- step, ok := parseCronStep(sec)
- if !ok {
- return 0, false, ""
- }
-
- if min == "*" && hour == "*" && day == "*" && month == "*" && weekday == "*" {
- minutes := max((step+59)/60, 1)
- warn := ""
- if step%60 != 0 {
- warn = "scheduler interval rounded up to minutes"
- }
- return minutes, true, warn
- }
- return 0, false, ""
-}
-
-func tryConvertMinuteOrHour(sec, min, hour, day, month, weekday string) (int, bool, string) {
- if (sec != "0" && sec != "*") || day != "*" || month != "*" || weekday != "*" {
- return 0, false, ""
- }
-
- if step, ok := parseCronStep(min); ok && hour == "*" {
- return step, true, ""
- }
- if min == "*" && hour == "*" {
- return 1, true, ""
- }
- if min == "0" {
- if step, ok := parseCronStep(hour); ok && day == "*" {
- return step * 60, true, ""
- }
- if hour == "*" {
- return 60, true, ""
- }
- }
- return 0, false, ""
-}
-
-func tryConvertDayStep(sec, min, hour, day, month, weekday string) (int, bool, string) {
- if (sec == "0" || sec == "*") && min == "0" && hour == "0" && month == "*" && weekday == "*" {
- if step, ok := parseCronStep(day); ok {
- return step * 1440, true, ""
- }
- }
- return 0, false, ""
-}
-
-func parseCronStep(field string) (int, bool) {
- if !strings.HasPrefix(field, "*/") {
- return 0, false
- }
- step, err := strconv.Atoi(strings.TrimPrefix(field, "*/"))
- if err != nil || step <= 0 {
- return 0, false
- }
- return step, true
-}
diff --git a/backend/pkg/libarcane/startup/startup_test.go b/backend/pkg/libarcane/startup/startup_test.go
index 7c027eb24..4be6e8aaf 100644
--- a/backend/pkg/libarcane/startup/startup_test.go
+++ b/backend/pkg/libarcane/startup/startup_test.go
@@ -4,7 +4,6 @@ import (
"context"
"errors"
"testing"
- "time"
"github.com/stretchr/testify/assert"
)
@@ -53,14 +52,14 @@ func TestLoadAgentToken(t *testing.T) {
}
getSettingFunc := func(ctx context.Context, key string, def string) string {
if key == "agentToken" {
- return "test-token-123"
+ return "loaded-token"
}
return def
}
LoadAgentToken(ctx, cfg, getSettingFunc)
- assert.Equal(t, "test-token-123", cfg.AgentToken)
+ assert.Equal(t, "loaded-token", cfg.AgentToken)
})
t.Run("does not load when not in agent mode", func(t *testing.T) {
@@ -68,66 +67,57 @@ func TestLoadAgentToken(t *testing.T) {
AgentMode: false,
AgentToken: "",
}
+ called := false
getSettingFunc := func(ctx context.Context, key string, def string) string {
- return "test-token-123"
+ called = true
+ return ""
}
LoadAgentToken(ctx, cfg, getSettingFunc)
+ assert.False(t, called)
assert.Empty(t, cfg.AgentToken)
})
- t.Run("does not override existing token", func(t *testing.T) {
+ t.Run("does not load when token already set", func(t *testing.T) {
cfg := &RuntimeConfig{
AgentMode: true,
AgentToken: "existing-token",
}
+ called := false
getSettingFunc := func(ctx context.Context, key string, def string) string {
- return "new-token"
- }
-
- LoadAgentToken(ctx, cfg, getSettingFunc)
-
- assert.Equal(t, "existing-token", cfg.AgentToken)
- })
-
- t.Run("handles empty token from database", func(t *testing.T) {
- cfg := &RuntimeConfig{
- AgentMode: true,
- AgentToken: "",
- }
- getSettingFunc := func(ctx context.Context, key string, def string) string {
+ called = true
return ""
}
LoadAgentToken(ctx, cfg, getSettingFunc)
- assert.Empty(t, cfg.AgentToken)
+ assert.False(t, called)
+ assert.Equal(t, "existing-token", cfg.AgentToken)
})
}
func TestEnsureEncryptionKey(t *testing.T) {
ctx := context.Background()
- t.Run("sets key in agent mode", func(t *testing.T) {
+ t.Run("sets key when in agent mode", func(t *testing.T) {
cfg := &RuntimeConfig{
- AgentMode: true,
- EncryptionKey: "",
+ AgentMode: true,
+ Environment: "production",
}
ensureKeyFunc := func(ctx context.Context) (string, error) {
- return "generated-key", nil
+ return "secret-key", nil
}
EnsureEncryptionKey(ctx, cfg, ensureKeyFunc)
- assert.Equal(t, "generated-key", cfg.EncryptionKey)
+ assert.Equal(t, "secret-key", cfg.EncryptionKey)
})
- t.Run("sets key in non-production", func(t *testing.T) {
+ t.Run("sets key when not in production", func(t *testing.T) {
cfg := &RuntimeConfig{
- AgentMode: false,
- Environment: "development",
- EncryptionKey: "",
+ AgentMode: false,
+ Environment: "development",
}
ensureKeyFunc := func(ctx context.Context) (string, error) {
return "dev-key", nil
@@ -138,25 +128,28 @@ func TestEnsureEncryptionKey(t *testing.T) {
assert.Equal(t, "dev-key", cfg.EncryptionKey)
})
- t.Run("does not set key in production when not agent", func(t *testing.T) {
+ t.Run("does not set key in production non-agent mode", func(t *testing.T) {
cfg := &RuntimeConfig{
AgentMode: false,
Environment: "production",
- EncryptionKey: "",
+ EncryptionKey: "existing",
}
+ called := false
ensureKeyFunc := func(ctx context.Context) (string, error) {
- return "should-not-set", nil
+ called = true
+ return "new-key", nil
}
EnsureEncryptionKey(ctx, cfg, ensureKeyFunc)
- assert.Empty(t, cfg.EncryptionKey)
+ assert.False(t, called)
+ assert.Equal(t, "existing", cfg.EncryptionKey)
})
t.Run("handles error gracefully", func(t *testing.T) {
cfg := &RuntimeConfig{
AgentMode: true,
- EncryptionKey: "",
+ EncryptionKey: "fallback",
}
ensureKeyFunc := func(ctx context.Context) (string, error) {
return "", errors.New("key generation failed")
@@ -164,7 +157,7 @@ func TestEnsureEncryptionKey(t *testing.T) {
EnsureEncryptionKey(ctx, cfg, ensureKeyFunc)
- assert.Empty(t, cfg.EncryptionKey)
+ assert.Equal(t, "fallback", cfg.EncryptionKey)
})
}
@@ -266,7 +259,7 @@ func TestInitializeNonAgentFeatures(t *testing.T) {
return nil
}
- InitializeNonAgentFeatures(ctx, cfg, createAdminFunc, reconcileDefaultAdminAPIKeyFunc, nil, nil, nil)
+ InitializeNonAgentFeatures(ctx, cfg, createAdminFunc, reconcileDefaultAdminAPIKeyFunc, nil)
assert.False(t, createAdminCalled)
assert.False(t, reconcileDefaultAdminAPIKeyCalled)
@@ -276,8 +269,6 @@ func TestInitializeNonAgentFeatures(t *testing.T) {
cfg := &RuntimeConfig{AgentMode: false}
createAdminCalled := false
reconcileDefaultAdminAPIKeyCalled := false
- migrateOidcCalled := false
- migrateDiscordCalled := false
autoLoginInitCalled := false
createAdminFunc := func(ctx context.Context) error {
@@ -292,21 +283,11 @@ func TestInitializeNonAgentFeatures(t *testing.T) {
autoLoginInitCalled = true
return nil
}
- migrateOidcFunc := func(ctx context.Context) error {
- migrateOidcCalled = true
- return nil
- }
- migrateDiscordFunc := func(ctx context.Context) error {
- migrateDiscordCalled = true
- return nil
- }
- InitializeNonAgentFeatures(ctx, cfg, createAdminFunc, reconcileDefaultAdminAPIKeyFunc, autoLoginInitFunc, migrateOidcFunc, migrateDiscordFunc)
+ InitializeNonAgentFeatures(ctx, cfg, createAdminFunc, reconcileDefaultAdminAPIKeyFunc, autoLoginInitFunc)
assert.True(t, createAdminCalled)
assert.True(t, reconcileDefaultAdminAPIKeyCalled)
- assert.True(t, migrateOidcCalled)
- assert.True(t, migrateDiscordCalled)
assert.True(t, autoLoginInitCalled)
})
@@ -321,429 +302,7 @@ func TestInitializeNonAgentFeatures(t *testing.T) {
createAdminFunc := func(ctx context.Context) error {
return errors.New("admin creation failed")
}
- migrateOidcFunc := func(ctx context.Context) error {
- return errors.New("oidc migration failed")
- }
- migrateDiscordFunc := func(ctx context.Context) error {
- return errors.New("discord migration failed")
- }
- InitializeNonAgentFeatures(ctx, cfg, createAdminFunc, reconcileDefaultAdminAPIKeyFunc, autoLoginInitFunc, migrateOidcFunc, migrateDiscordFunc)
+ InitializeNonAgentFeatures(ctx, cfg, createAdminFunc, reconcileDefaultAdminAPIKeyFunc, autoLoginInitFunc)
})
}
-
-func TestMigrateSchedulerCronValues(t *testing.T) {
- ctx := context.Background()
-
- t.Run("migrates minute-based intervals to cron", func(t *testing.T) {
- settings := map[string]string{
- "pollingInterval": "15",
- }
- updateCalled := false
-
- getSettingFunc := func(ctx context.Context, key string, def string) string {
- if val, ok := settings[key]; ok {
- return val
- }
- return def
- }
- updateSettingFunc := func(ctx context.Context, key string, value string) error {
- updateCalled = true
- assert.Equal(t, "pollingInterval", key)
- assert.Equal(t, "0 */15 * * * *", value)
- return nil
- }
- reloadFunc := func(ctx context.Context) error {
- return nil
- }
-
- MigrateSchedulerCronValues(ctx, getSettingFunc, updateSettingFunc, reloadFunc)
-
- assert.True(t, updateCalled)
- })
-
- t.Run("migrates duration strings", func(t *testing.T) {
- settings := map[string]string{
- "autoUpdateInterval": "30m",
- }
- updateCalled := false
-
- getSettingFunc := func(ctx context.Context, key string, def string) string {
- if val, ok := settings[key]; ok {
- return val
- }
- return def
- }
- updateSettingFunc := func(ctx context.Context, key string, value string) error {
- updateCalled = true
- assert.Equal(t, "autoUpdateInterval", key)
- assert.Equal(t, "0 */30 * * * *", value)
- return nil
- }
- reloadFunc := func(ctx context.Context) error {
- return nil
- }
-
- MigrateSchedulerCronValues(ctx, getSettingFunc, updateSettingFunc, reloadFunc)
-
- assert.True(t, updateCalled)
- })
-
- t.Run("skips already valid cron expressions", func(t *testing.T) {
- settings := map[string]string{
- "pollingInterval": "0 */15 * * * *",
- }
- updateCalled := false
-
- getSettingFunc := func(ctx context.Context, key string, def string) string {
- if val, ok := settings[key]; ok {
- return val
- }
- return def
- }
- updateSettingFunc := func(ctx context.Context, key string, value string) error {
- updateCalled = true
- return nil
- }
- reloadFunc := func(ctx context.Context) error {
- return nil
- }
-
- MigrateSchedulerCronValues(ctx, getSettingFunc, updateSettingFunc, reloadFunc)
-
- assert.False(t, updateCalled)
- })
-
- t.Run("handles update errors", func(t *testing.T) {
- settings := map[string]string{
- "pollingInterval": "15",
- }
-
- getSettingFunc := func(ctx context.Context, key string, def string) string {
- if val, ok := settings[key]; ok {
- return val
- }
- return def
- }
- updateSettingFunc := func(ctx context.Context, key string, value string) error {
- return errors.New("update failed")
- }
- reloadFunc := func(ctx context.Context) error {
- return nil
- }
-
- MigrateSchedulerCronValues(ctx, getSettingFunc, updateSettingFunc, reloadFunc)
- })
-}
-
-func TestMigrateGitOpsSyncIntervals(t *testing.T) {
- ctx := context.Background()
-
- t.Run("migrates intervals to minutes", func(t *testing.T) {
- items := []IntervalMigrationItem{
- {ID: "sync-1", RawValue: "30"},
- {ID: "sync-2", RawValue: "1h"},
- }
- updates := make(map[string]int)
-
- listFunc := func(ctx context.Context) ([]IntervalMigrationItem, error) {
- return items, nil
- }
- updateFunc := func(ctx context.Context, id string, minutes int) error {
- updates[id] = minutes
- return nil
- }
-
- MigrateGitOpsSyncIntervals(ctx, listFunc, updateFunc)
-
- assert.Len(t, updates, 1)
- assert.Equal(t, 60, updates["sync-2"])
- })
-
- t.Run("handles list error", func(t *testing.T) {
- listFunc := func(ctx context.Context) ([]IntervalMigrationItem, error) {
- return nil, errors.New("list failed")
- }
- updateFunc := func(ctx context.Context, id string, minutes int) error {
- return nil
- }
-
- MigrateGitOpsSyncIntervals(ctx, listFunc, updateFunc)
- })
-
- t.Run("handles nil functions", func(t *testing.T) {
- MigrateGitOpsSyncIntervals(ctx, nil, nil)
- })
-}
-
-func TestParseSchedulerDuration(t *testing.T) {
- tests := []struct {
- name string
- raw string
- defaultUnit time.Duration
- wantDuration time.Duration
- wantOk bool
- }{
- {"empty string", "", time.Minute, 0, false},
- {"valid duration string", "30m", time.Minute, 30 * time.Minute, true},
- {"integer with default minute", "15", time.Minute, 15 * time.Minute, true},
- {"integer with default hour", "2", time.Hour, 2 * time.Hour, true},
- {"seconds duration", "45s", time.Minute, 45 * time.Second, true},
- {"hours duration", "2h", time.Minute, 2 * time.Hour, true},
- {"invalid format", "abc", time.Minute, 0, false},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- gotDuration, gotOk := parseSchedulerDuration(tt.raw, tt.defaultUnit)
- assert.Equal(t, tt.wantOk, gotOk)
- if gotOk {
- assert.Equal(t, tt.wantDuration, gotDuration)
- }
- })
- }
-}
-
-func TestDurationToCron(t *testing.T) {
- tests := []struct {
- name string
- duration time.Duration
- wantCron string
- wantWarn string
- }{
- {"zero duration", 0, "", ""},
- {"negative duration", -1 * time.Minute, "", ""},
- {"30 seconds", 30 * time.Second, "*/30 * * * * *", ""},
- {"1 minute", time.Minute, "0 */1 * * * *", ""},
- {"15 minutes", 15 * time.Minute, "0 */15 * * * *", ""},
- {"1 hour", time.Hour, "0 0 */1 * * *", ""},
- {"24 hours", 24 * time.Hour, "0 0 0 */1 * *", ""},
- {"45 seconds rounds up", 45 * time.Second, "*/45 * * * * *", ""},
- {"90 seconds rounds to 2 min", 90 * time.Second, "0 */2 * * * *", "scheduler interval rounded up to minutes"},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- gotCron, gotWarn := durationToCron(tt.duration)
- assert.Equal(t, tt.wantCron, gotCron)
- if tt.wantWarn != "" {
- assert.Contains(t, gotWarn, tt.wantWarn)
- }
- })
- }
-}
-
-func TestMinutesToCron(t *testing.T) {
- tests := []struct {
- name string
- minutes int
- wantCron string
- }{
- {"zero minutes", 0, ""},
- {"negative minutes", -1, ""},
- {"15 minutes", 15, "0 */15 * * * *"},
- {"30 minutes", 30, "0 */30 * * * *"},
- {"60 minutes", 60, "0 0 */1 * * *"},
- {"120 minutes", 120, "0 0 */2 * * *"},
- {"1440 minutes (1 day)", 1440, "0 0 0 */1 * *"},
- {"2880 minutes (2 days)", 2880, "0 0 0 */2 * *"},
- {"90 minutes", 90, "0 */90 * * * *"},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- gotCron := minutesToCron(tt.minutes)
- assert.Equal(t, tt.wantCron, gotCron)
- })
- }
-}
-
-func TestNormalizeSchedulerValueToCron(t *testing.T) {
- tests := []struct {
- name string
- raw string
- defaultUnit time.Duration
- wantCron string
- wantShouldUpdate bool
- }{
- {"empty string", "", time.Minute, "", false},
- {"@hourly special", "@hourly", time.Minute, "@hourly", false},
- {"valid 6-field cron", "0 */15 * * * *", time.Minute, "0 */15 * * * *", false},
- {"5-field cron adds second", "*/15 * * * *", time.Minute, "0 */15 * * * *", true},
- {"integer minutes", "30", time.Minute, "0 */30 * * * *", true},
- {"duration string", "1h", time.Minute, "0 0 */1 * * *", true},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- gotCron, gotShouldUpdate, _ := normalizeSchedulerValueToCron(tt.raw, tt.defaultUnit)
- assert.Equal(t, tt.wantCron, gotCron)
- assert.Equal(t, tt.wantShouldUpdate, gotShouldUpdate)
- })
- }
-}
-
-func TestNormalizeSchedulerValueToMinutes(t *testing.T) {
- tests := []struct {
- name string
- raw string
- defaultUnit time.Duration
- wantMinutes int
- wantShouldUpdate bool
- }{
- {"empty string", "", time.Minute, 0, false},
- {"@hourly special", "@hourly", time.Minute, 0, false},
- {"integer already minutes", "30", time.Minute, 30, false},
- {"duration string", "1h", time.Minute, 60, true},
- {"cron every hour", "0 0 * * * *", time.Minute, 60, true},
- {"cron every 15 min", "0 */15 * * * *", time.Minute, 15, true},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- gotMinutes, gotShouldUpdate, _ := normalizeSchedulerValueToMinutes(tt.raw, tt.defaultUnit)
- assert.Equal(t, tt.wantMinutes, gotMinutes)
- assert.Equal(t, tt.wantShouldUpdate, gotShouldUpdate)
- })
- }
-}
-
-func TestCronToMinutes(t *testing.T) {
- tests := []struct {
- name string
- fields []string
- wantMinutes int
- wantOk bool
- }{
- {"every 30 seconds", []string{"*/30", "*", "*", "*", "*", "*"}, 1, true},
- {"every 15 minutes", []string{"0", "*/15", "*", "*", "*", "*"}, 15, true},
- {"every hour", []string{"0", "0", "*", "*", "*", "*"}, 60, true},
- {"every 2 hours", []string{"0", "0", "*/2", "*", "*", "*"}, 120, true},
- {"every day", []string{"0", "0", "0", "*/1", "*", "*"}, 1440, true},
- {"too few fields", []string{"0", "*/15", "*", "*", "*"}, 0, false},
- {"complex pattern", []string{"0", "15", "*/2", "*", "*", "*"}, 0, false},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- gotMinutes, gotOk, _ := cronToMinutes(tt.fields)
- assert.Equal(t, tt.wantOk, gotOk)
- if gotOk {
- assert.Equal(t, tt.wantMinutes, gotMinutes)
- }
- })
- }
-}
-
-func TestParseCronStep(t *testing.T) {
- tests := []struct {
- name string
- field string
- wantStep int
- wantOk bool
- }{
- {"valid step", "*/15", 15, true},
- {"no prefix", "15", 0, false},
- {"zero step", "*/0", 0, false},
- {"negative step", "*/-5", 0, false},
- {"invalid number", "*/abc", 0, false},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- gotStep, gotOk := parseCronStep(tt.field)
- assert.Equal(t, tt.wantOk, gotOk)
- if gotOk {
- assert.Equal(t, tt.wantStep, gotStep)
- }
- })
- }
-}
-
-func TestTryConvertSecondStep(t *testing.T) {
- tests := []struct {
- name string
- sec string
- min string
- hour string
- day string
- month string
- weekday string
- wantMinutes int
- wantOk bool
- }{
- {"every 30 seconds", "*/30", "*", "*", "*", "*", "*", 1, true},
- {"every 60 seconds", "*/60", "*", "*", "*", "*", "*", 1, true},
- {"every 90 seconds", "*/90", "*", "*", "*", "*", "*", 2, true},
- {"not wildcard minutes", "*/30", "0", "*", "*", "*", "*", 0, false},
- {"not step pattern", "0", "*", "*", "*", "*", "*", 0, false},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- gotMinutes, gotOk, _ := tryConvertSecondStep(tt.sec, tt.min, tt.hour, tt.day, tt.month, tt.weekday)
- assert.Equal(t, tt.wantOk, gotOk)
- if gotOk {
- assert.Equal(t, tt.wantMinutes, gotMinutes)
- }
- })
- }
-}
-
-func TestTryConvertMinuteOrHour(t *testing.T) {
- tests := []struct {
- name string
- sec string
- min string
- hour string
- day string
- month string
- weekday string
- wantMinutes int
- wantOk bool
- }{
- {"every 15 minutes", "0", "*/15", "*", "*", "*", "*", 15, true},
- {"every hour", "0", "0", "*", "*", "*", "*", 60, true},
- {"every 2 hours", "0", "0", "*/2", "*", "*", "*", 120, true},
- {"complex pattern", "0", "30", "*/2", "*", "*", "*", 0, false},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- gotMinutes, gotOk, _ := tryConvertMinuteOrHour(tt.sec, tt.min, tt.hour, tt.day, tt.month, tt.weekday)
- assert.Equal(t, tt.wantOk, gotOk)
- if gotOk {
- assert.Equal(t, tt.wantMinutes, gotMinutes)
- }
- })
- }
-}
-
-func TestTryConvertDayStep(t *testing.T) {
- tests := []struct {
- name string
- sec string
- min string
- hour string
- day string
- month string
- weekday string
- wantMinutes int
- wantOk bool
- }{
- {"every day", "0", "0", "0", "*/1", "*", "*", 1440, true},
- {"every 2 days", "0", "0", "0", "*/2", "*", "*", 2880, true},
- {"not midnight", "0", "0", "1", "*/1", "*", "*", 0, false},
- {"not step pattern", "0", "0", "0", "1", "*", "*", 0, false},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- gotMinutes, gotOk, _ := tryConvertDayStep(tt.sec, tt.min, tt.hour, tt.day, tt.month, tt.weekday)
- assert.Equal(t, tt.wantOk, gotOk)
- if gotOk {
- assert.Equal(t, tt.wantMinutes, gotMinutes)
- }
- })
- }
-}
diff --git a/backend/pkg/scheduler/auto_update_job.go b/backend/pkg/scheduler/auto_update_job.go
index 7f6ddefad..9429a170d 100644
--- a/backend/pkg/scheduler/auto_update_job.go
+++ b/backend/pkg/scheduler/auto_update_job.go
@@ -2,9 +2,7 @@ package scheduler
import (
"context"
- "fmt"
"log/slog"
- "strconv"
"github.com/getarcaneapp/arcane/backend/internal/services"
)
@@ -36,21 +34,6 @@ func (j *AutoUpdateJob) Schedule(ctx context.Context) string {
if s == "" {
return "0 0 0 * * *"
}
-
- // Handle legacy straight int if it somehow didn't get migrated
- if i, err := strconv.Atoi(s); err == nil {
- if i <= 0 {
- i = 1440
- }
- if i%1440 == 0 {
- return fmt.Sprintf("0 0 0 */%d * *", i/1440)
- }
- if i%60 == 0 {
- return fmt.Sprintf("0 0 */%d * * *", i/60)
- }
- return fmt.Sprintf("0 */%d * * * *", i)
- }
-
return s
}
diff --git a/backend/pkg/scheduler/environment_health_job.go b/backend/pkg/scheduler/environment_health_job.go
index 514ac798f..ffb39be33 100644
--- a/backend/pkg/scheduler/environment_health_job.go
+++ b/backend/pkg/scheduler/environment_health_job.go
@@ -2,9 +2,7 @@ package scheduler
import (
"context"
- "fmt"
"log/slog"
- "strconv"
"sync/atomic"
"time"
@@ -48,18 +46,6 @@ func (j *EnvironmentHealthJob) Schedule(ctx context.Context) string {
if s == "" {
return "0 */2 * * * *"
}
-
- // Handle legacy straight int if it somehow didn't get migrated
- if i, err := strconv.Atoi(s); err == nil {
- if i <= 0 {
- i = 2
- }
- if i%60 == 0 {
- return fmt.Sprintf("0 0 */%d * * *", i/60)
- }
- return fmt.Sprintf("0 */%d * * * *", i)
- }
-
return s
}
diff --git a/backend/pkg/scheduler/event_cleanup_job.go b/backend/pkg/scheduler/event_cleanup_job.go
index 96429970f..c49c7956f 100644
--- a/backend/pkg/scheduler/event_cleanup_job.go
+++ b/backend/pkg/scheduler/event_cleanup_job.go
@@ -2,9 +2,7 @@ package scheduler
import (
"context"
- "fmt"
"log/slog"
- "strconv"
"time"
"github.com/getarcaneapp/arcane/backend/internal/services"
@@ -33,18 +31,6 @@ func (j *EventCleanupJob) Schedule(ctx context.Context) string {
if s == "" {
return "0 0 */6 * * *"
}
-
- // Handle legacy straight int if it somehow didn't get migrated
- if i, err := strconv.Atoi(s); err == nil {
- if i <= 0 {
- i = 360
- }
- if i%60 == 0 {
- return fmt.Sprintf("0 0 */%d * * *", i/60)
- }
- return fmt.Sprintf("0 */%d * * * *", i)
- }
-
return s
}
diff --git a/backend/pkg/scheduler/gitops_sync_job.go b/backend/pkg/scheduler/gitops_sync_job.go
index a90ccab60..b1ac03e95 100644
--- a/backend/pkg/scheduler/gitops_sync_job.go
+++ b/backend/pkg/scheduler/gitops_sync_job.go
@@ -2,9 +2,7 @@ package scheduler
import (
"context"
- "fmt"
"log/slog"
- "strconv"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/robfig/cron/v3"
@@ -36,18 +34,6 @@ func (j *GitOpsSyncJob) Schedule(ctx context.Context) string {
schedule = "0 */1 * * * *"
}
- // Handle legacy straight int if it somehow didn't get migrated
- if i, err := strconv.Atoi(schedule); err == nil {
- if i <= 0 {
- i = 1
- }
- if i%60 == 0 {
- schedule = fmt.Sprintf("0 0 */%d * * *", i/60)
- } else {
- schedule = fmt.Sprintf("0 */%d * * * *", i)
- }
- }
-
parser := cron.NewParser(cron.Second | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow)
if _, err := parser.Parse(schedule); err != nil {
slog.WarnContext(ctx, "Invalid cron expression for gitops-sync, using default", "invalid_schedule", schedule, "error", err)
diff --git a/backend/pkg/scheduler/gitops_sync_job_test.go b/backend/pkg/scheduler/gitops_sync_job_test.go
index 85fcd6da0..fe13620b1 100644
--- a/backend/pkg/scheduler/gitops_sync_job_test.go
+++ b/backend/pkg/scheduler/gitops_sync_job_test.go
@@ -26,16 +26,6 @@ func TestGitOpsSyncJobSchedule_UsesConfiguredCron(t *testing.T) {
require.Equal(t, "0 */7 * * * *", got)
}
-func TestGitOpsSyncJobSchedule_LegacyIntegerMinutes(t *testing.T) {
- ctx := context.Background()
- _, settingsSvc, _ := setupAnalyticsStateServicesInternal(t)
- require.NoError(t, settingsSvc.SetStringSetting(ctx, "gitopsSyncInterval", "120"))
- job := NewGitOpsSyncJob(nil, settingsSvc)
-
- got := job.Schedule(ctx)
- require.Equal(t, "0 0 */2 * * *", got)
-}
-
func TestGitOpsSyncJobSchedule_InvalidCronFallsBackToDefault(t *testing.T) {
ctx := context.Background()
_, settingsSvc, _ := setupAnalyticsStateServicesInternal(t)
diff --git a/backend/pkg/scheduler/image_polling_job.go b/backend/pkg/scheduler/image_polling_job.go
index fab417f3f..bb5126d3f 100644
--- a/backend/pkg/scheduler/image_polling_job.go
+++ b/backend/pkg/scheduler/image_polling_job.go
@@ -2,9 +2,7 @@ package scheduler
import (
"context"
- "fmt"
"log/slog"
- "strconv"
"github.com/getarcaneapp/arcane/backend/internal/services"
)
@@ -36,18 +34,6 @@ func (j *ImagePollingJob) Schedule(ctx context.Context) string {
if s == "" {
return "0 0 * * * *"
}
-
- // Handle legacy straight int if it somehow didn't get migrated
- if i, err := strconv.Atoi(s); err == nil {
- if i <= 0 {
- i = 60
- }
- if i%60 == 0 {
- return fmt.Sprintf("0 0 */%d * * *", i/60)
- }
- return fmt.Sprintf("0 */%d * * * *", i)
- }
-
return s
}
diff --git a/backend/pkg/scheduler/scheduled_prune_job.go b/backend/pkg/scheduler/scheduled_prune_job.go
index 6b4810ccd..238609dd6 100644
--- a/backend/pkg/scheduler/scheduled_prune_job.go
+++ b/backend/pkg/scheduler/scheduled_prune_job.go
@@ -2,9 +2,7 @@ package scheduler
import (
"context"
- "fmt"
"log/slog"
- "strconv"
"github.com/getarcaneapp/arcane/backend/internal/services"
"github.com/getarcaneapp/arcane/types/system"
@@ -41,21 +39,6 @@ func (j *ScheduledPruneJob) Schedule(ctx context.Context) string {
schedule = "0 0 0 * * *"
}
- // Handle legacy straight int if it somehow didn't get migrated
- if i, err := strconv.Atoi(schedule); err == nil {
- if i <= 0 {
- i = 1440
- }
- switch {
- case i%1440 == 0:
- schedule = fmt.Sprintf("0 0 0 */%d * *", i/1440)
- case i%60 == 0:
- schedule = fmt.Sprintf("0 0 */%d * * *", i/60)
- default:
- schedule = fmt.Sprintf("0 */%d * * * *", i)
- }
- }
-
parser := cron.NewParser(cron.Second | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow)
if _, err := parser.Parse(schedule); err != nil {
slog.WarnContext(ctx, "Invalid cron expression for scheduled-prune, using default", "invalid_schedule", schedule, "error", err)
diff --git a/backend/pkg/scheduler/vulnerability_scan_job.go b/backend/pkg/scheduler/vulnerability_scan_job.go
index 126c59d34..090ce325d 100644
--- a/backend/pkg/scheduler/vulnerability_scan_job.go
+++ b/backend/pkg/scheduler/vulnerability_scan_job.go
@@ -2,9 +2,7 @@ package scheduler
import (
"context"
- "fmt"
"log/slog"
- "strconv"
"github.com/getarcaneapp/arcane/backend/internal/models"
"github.com/getarcaneapp/arcane/backend/internal/services"
@@ -49,21 +47,6 @@ func (j *VulnerabilityScanJob) Schedule(ctx context.Context) string {
schedule = "0 0 0 * * *"
}
- // Handle legacy straight int if it somehow didn't get migrated
- if i, err := strconv.Atoi(schedule); err == nil {
- if i <= 0 {
- i = 1440
- }
- switch {
- case i%1440 == 0:
- schedule = fmt.Sprintf("0 0 0 */%d * *", i/1440)
- case i%60 == 0:
- schedule = fmt.Sprintf("0 0 */%d * * *", i/60)
- default:
- schedule = fmt.Sprintf("0 */%d * * * *", i)
- }
- }
-
parser := cron.NewParser(cron.Second | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow)
if _, err := parser.Parse(schedule); err != nil {
slog.WarnContext(ctx, "Invalid cron expression for vulnerability-scan, using default", "invalid_schedule", schedule, "error", err)
diff --git a/backend/resources/migrations/postgres/053_drop_deprecated_v2.down.sql b/backend/resources/migrations/postgres/053_drop_deprecated_v2.down.sql
new file mode 100644
index 000000000..786df4a83
--- /dev/null
+++ b/backend/resources/migrations/postgres/053_drop_deprecated_v2.down.sql
@@ -0,0 +1,10 @@
+-- v2.0.0 rollback: recreate the apprise_settings table shape (data is not restored).
+CREATE TABLE IF NOT EXISTS apprise_settings (
+ id SERIAL PRIMARY KEY,
+ api_url TEXT NOT NULL,
+ enabled BOOLEAN NOT NULL DEFAULT FALSE,
+ image_update_tag VARCHAR(255),
+ container_update_tag VARCHAR(255),
+ created_at TIMESTAMP,
+ updated_at TIMESTAMP
+);
diff --git a/backend/resources/migrations/postgres/053_drop_deprecated_v2.up.sql b/backend/resources/migrations/postgres/053_drop_deprecated_v2.up.sql
new file mode 100644
index 000000000..c3bbe402d
--- /dev/null
+++ b/backend/resources/migrations/postgres/053_drop_deprecated_v2.up.sql
@@ -0,0 +1,12 @@
+-- v2.0.0: drop the Apprise notification service table and deprecated settings rows.
+DROP TABLE IF EXISTS apprise_settings;
+
+DELETE FROM settings WHERE key IN (
+ 'dockerPruneMode',
+ 'scheduledPruneContainers',
+ 'scheduledPruneImages',
+ 'scheduledPruneVolumes',
+ 'scheduledPruneNetworks',
+ 'scheduledPruneBuildCache',
+ 'authOidcConfig'
+);
diff --git a/backend/resources/migrations/sqlite/053_drop_deprecated_v2.down.sql b/backend/resources/migrations/sqlite/053_drop_deprecated_v2.down.sql
new file mode 100644
index 000000000..4cffbb72a
--- /dev/null
+++ b/backend/resources/migrations/sqlite/053_drop_deprecated_v2.down.sql
@@ -0,0 +1,10 @@
+-- v2.0.0 rollback: recreate the apprise_settings table shape (data is not restored).
+CREATE TABLE IF NOT EXISTS apprise_settings (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ api_url TEXT NOT NULL,
+ enabled INTEGER NOT NULL DEFAULT 0,
+ image_update_tag VARCHAR(255),
+ container_update_tag VARCHAR(255),
+ created_at DATETIME,
+ updated_at DATETIME
+);
diff --git a/backend/resources/migrations/sqlite/053_drop_deprecated_v2.up.sql b/backend/resources/migrations/sqlite/053_drop_deprecated_v2.up.sql
new file mode 100644
index 000000000..c3bbe402d
--- /dev/null
+++ b/backend/resources/migrations/sqlite/053_drop_deprecated_v2.up.sql
@@ -0,0 +1,12 @@
+-- v2.0.0: drop the Apprise notification service table and deprecated settings rows.
+DROP TABLE IF EXISTS apprise_settings;
+
+DELETE FROM settings WHERE key IN (
+ 'dockerPruneMode',
+ 'scheduledPruneContainers',
+ 'scheduledPruneImages',
+ 'scheduledPruneVolumes',
+ 'scheduledPruneNetworks',
+ 'scheduledPruneBuildCache',
+ 'authOidcConfig'
+);
diff --git a/cli/internal/config/config.go b/cli/internal/config/config.go
index 738604833..67d6582b5 100644
--- a/cli/internal/config/config.go
+++ b/cli/internal/config/config.go
@@ -68,36 +68,9 @@ func normalizeConfig(cfg *types.Config) *types.Config {
return DefaultConfig()
}
- if normalized.Pagination.Default.Limit <= 0 && normalized.DefaultLimit > 0 {
- normalized.Pagination.Default.Limit = normalized.DefaultLimit
- }
- if normalized.DefaultLimit <= 0 && normalized.Pagination.Default.Limit > 0 {
- normalized.DefaultLimit = normalized.Pagination.Default.Limit
- }
-
if normalized.Pagination.Resources == nil {
normalized.Pagination.Resources = make(map[string]types.PaginationResourceConfig)
}
- if normalized.ResourceLimits == nil {
- normalized.ResourceLimits = make(map[string]int)
- }
-
- for resource, limit := range normalized.ResourceLimits {
- resource = types.NormalizePaginatedResource(resource)
- if resource == "" || limit <= 0 {
- continue
- }
- if _, exists := normalized.Pagination.Resources[resource]; !exists {
- normalized.Pagination.Resources[resource] = types.PaginationResourceConfig{Limit: limit}
- }
- }
- for resource, cfg := range normalized.Pagination.Resources {
- resource = types.NormalizePaginatedResource(resource)
- if resource == "" || cfg.Limit <= 0 {
- continue
- }
- normalized.ResourceLimits[resource] = cfg.Limit
- }
return normalized
}
@@ -278,24 +251,6 @@ func Save(c *types.Config) error {
v.Set(fmt.Sprintf("pagination.resources.%s.limit", resource), rc.Limit)
}
- // Legacy keys retained for backward compatibility.
- if cfg.DefaultLimit > 0 {
- v.Set("default_limit", cfg.DefaultLimit)
- }
- if len(cfg.ResourceLimits) > 0 {
- legacy := make(map[string]int)
- for resource, limit := range cfg.ResourceLimits {
- resource = types.NormalizePaginatedResource(resource)
- if resource == "" || limit <= 0 {
- continue
- }
- legacy[resource] = limit
- }
- if len(legacy) > 0 {
- v.Set("resource_limits", legacy)
- }
- }
-
if err := v.WriteConfigAs(path); err != nil {
return fmt.Errorf("failed to write config file: %w", err)
}
@@ -353,13 +308,6 @@ func InitDefaultFile() (bool, error) {
v.Set(fmt.Sprintf("pagination.resources.%s.limit", resource), defaultPaginationInitLimit)
}
- v.Set("default_limit", defaultPaginationInitLimit)
- legacy := make(map[string]int, len(types.KnownPaginatedResources))
- for _, resource := range types.KnownPaginatedResources {
- legacy[resource] = defaultPaginationInitLimit
- }
- v.Set("resource_limits", legacy)
-
if err := v.WriteConfigAs(path); err != nil {
return false, fmt.Errorf("failed to write config file: %w", err)
}
diff --git a/cli/internal/config/config_test.go b/cli/internal/config/config_test.go
index 2af0f6e1a..723ebec8a 100644
--- a/cli/internal/config/config_test.go
+++ b/cli/internal/config/config_test.go
@@ -53,7 +53,7 @@ func TestLoadReturnsDefaultsWhenFileMissing(t *testing.T) {
}
}
-func TestSaveAndLoadRoundTripPaginationCompatibility(t *testing.T) {
+func TestSaveAndLoadRoundTripPagination(t *testing.T) {
path := setTempConfigPath(t)
cfg := DefaultConfig()
@@ -75,12 +75,6 @@ func TestSaveAndLoadRoundTripPaginationCompatibility(t *testing.T) {
if !strings.Contains(text, "pagination:") {
t.Fatalf("expected saved YAML to include pagination block:\n%s", text)
}
- if !strings.Contains(text, "default_limit: 42") {
- t.Fatalf("expected saved YAML to include legacy default_limit key:\n%s", text)
- }
- if !strings.Contains(text, "resource_limits:") {
- t.Fatalf("expected saved YAML to include legacy resource_limits key:\n%s", text)
- }
if !strings.Contains(text, "cli_update_channel: next") {
t.Fatalf("expected saved YAML to include cli_update_channel key:\n%s", text)
}
@@ -97,8 +91,8 @@ func TestSaveAndLoadRoundTripPaginationCompatibility(t *testing.T) {
if err != nil {
t.Fatalf("Load() failed: %v", err)
}
- if loaded.Pagination.Default.Limit != 42 || loaded.DefaultLimit != 42 {
- t.Fatalf("default limit mismatch: pagination=%d legacy=%d", loaded.Pagination.Default.Limit, loaded.DefaultLimit)
+ if loaded.Pagination.Default.Limit != 42 {
+ t.Fatalf("default limit mismatch: pagination=%d, want 42", loaded.Pagination.Default.Limit)
}
if got := loaded.LimitFor("images"); got != 17 {
t.Fatalf("images limit=%d, want 17", got)
@@ -111,39 +105,6 @@ func TestSaveAndLoadRoundTripPaginationCompatibility(t *testing.T) {
}
}
-func TestLoadLegacyPaginationKeys(t *testing.T) {
- path := setTempConfigPath(t)
- content := `
-server_url: https://arcane.example
-default_environment: "7"
-log_level: warn
-default_limit: 25
-resource_limits:
- image: 31
- Volumes: 5
-`
- if err := os.WriteFile(path, []byte(content), 0o600); err != nil {
- t.Fatalf("failed to write config fixture: %v", err)
- }
-
- cfg, err := Load()
- if err != nil {
- t.Fatalf("Load() failed: %v", err)
- }
- if cfg.ServerURL != "https://arcane.example" {
- t.Fatalf("ServerURL=%q, want %q", cfg.ServerURL, "https://arcane.example")
- }
- if cfg.Pagination.Default.Limit != 25 || cfg.DefaultLimit != 25 {
- t.Fatalf("default limit mismatch: pagination=%d legacy=%d", cfg.Pagination.Default.Limit, cfg.DefaultLimit)
- }
- if got := cfg.LimitFor("images"); got != 31 {
- t.Fatalf("images limit=%d, want 31", got)
- }
- if got := cfg.LimitFor("volumes"); got != 5 {
- t.Fatalf("volumes limit=%d, want 5", got)
- }
-}
-
func TestLoadCanonicalPaginationBlock(t *testing.T) {
path := setTempConfigPath(t)
content := `
@@ -210,8 +171,6 @@ func TestInitDefaultFileCreatesTemplate(t *testing.T) {
"default_environment:",
"log_level:",
"pagination:",
- "default_limit:",
- "resource_limits:",
}
for _, key := range requiredKeys {
if !strings.Contains(text, key) {
@@ -231,9 +190,6 @@ func TestInitDefaultFileCreatesTemplate(t *testing.T) {
if cfg.Pagination.Default.Limit != defaultPaginationInitLimit {
t.Fatalf("Pagination.Default.Limit=%d, want %d", cfg.Pagination.Default.Limit, defaultPaginationInitLimit)
}
- if cfg.DefaultLimit != defaultPaginationInitLimit {
- t.Fatalf("DefaultLimit=%d, want %d", cfg.DefaultLimit, defaultPaginationInitLimit)
- }
for _, resource := range []string{"containers", "images", "volumes", "networks", "projects", "environments", "registries", "templates", "users", "events", "apikeys"} {
if got := cfg.LimitFor(resource); got != defaultPaginationInitLimit {
t.Fatalf("LimitFor(%s)=%d, want %d", resource, got, defaultPaginationInitLimit)
diff --git a/cli/internal/integrationtest/projects_json_compat_test.go b/cli/internal/integrationtest/projects_json_compat_test.go
deleted file mode 100644
index 0614a8f99..000000000
--- a/cli/internal/integrationtest/projects_json_compat_test.go
+++ /dev/null
@@ -1,112 +0,0 @@
-package integrationtest
-
-import (
- "encoding/json"
- "net/http"
- "net/http/httptest"
- "strings"
- "testing"
-)
-
-func TestProjectsJSONCompatibilityForComposeUnitBytes(t *testing.T) {
- projectResponse := `{
- "success": true,
- "data": {
- "id": "project-1",
- "name": "myproject",
- "path": "/tmp/myproject",
- "status": "running",
- "serviceCount": 1,
- "runningCount": 1,
- "createdAt": "2026-03-13T00:00:00Z",
- "updatedAt": "2026-03-13T00:00:00Z",
- "services": [
- {
- "name": "myapp",
- "image": "nginx:latest",
- "mem_limit": "256m",
- "build": {
- "context": ".",
- "shm_size": "64m"
- },
- "deploy": {
- "resources": {
- "limits": {
- "memory": "512m"
- }
- }
- }
- }
- ],
- "runtimeServices": [
- {
- "name": "myapp",
- "image": "nginx:latest",
- "status": "running",
- "serviceConfig": {
- "name": "myapp",
- "image": "nginx:latest",
- "mem_limit": "256m"
- }
- }
- ]
- }
- }`
-
- downCalled := false
- srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- switch {
- case r.Method == http.MethodGet && r.URL.Path == "/api/environments/0/projects/myproject":
- w.Header().Set("Content-Type", "application/json")
- _, _ = w.Write([]byte(projectResponse))
- case r.Method == http.MethodPost && r.URL.Path == "/api/environments/0/projects/project-1/down":
- downCalled = true
- w.Header().Set("Content-Type", "application/json")
- _, _ = w.Write([]byte(`{"success":true,"data":{"message":"stopped"}}`))
- default:
- w.WriteHeader(http.StatusNotFound)
- _, _ = w.Write([]byte(`{"success":false,"error":"not found"}`))
- }
- }))
- defer srv.Close()
-
- configPath := writeCLIIntegrationConfigInternal(t, srv.URL)
-
- getStdout, getStderr, err := executeCLIIntegrationCommandInternal(
- t,
- []string{"--config", configPath, "projects", "get", "myproject", "--json"},
- )
- if err != nil {
- t.Fatalf("projects get failed: %v (%s)", err, getStderr)
- }
-
- var decoded map[string]any
- if err := json.Unmarshal([]byte(strings.TrimSpace(getStdout)), &decoded); err != nil {
- t.Fatalf("projects get produced invalid JSON: %v\noutput=%s", err, getStdout)
- }
-
- services, ok := decoded["services"].([]any)
- if !ok || len(services) != 1 {
- t.Fatalf("expected one service in JSON output, got %#v", decoded["services"])
- }
-
- serviceMap, ok := services[0].(map[string]any)
- if !ok {
- t.Fatalf("expected service entry to be a map, got %#v", services[0])
- }
-
- if got := serviceMap["mem_limit"]; got != "268435456" {
- t.Fatalf("expected mem_limit to round-trip as normalized bytes, got %#v", got)
- }
-
- _, downStderr, err := executeCLIIntegrationCommandInternal(
- t,
- []string{"--config", configPath, "projects", "down", "myproject"},
- )
- if err != nil {
- t.Fatalf("projects down failed: %v (%s)", err, downStderr)
- }
- if !downCalled {
- t.Fatal("expected projects down to issue a POST after resolving the project")
- }
-}
diff --git a/cli/internal/types/config.go b/cli/internal/types/config.go
index 7debc3c6a..589d63bee 100644
--- a/cli/internal/types/config.go
+++ b/cli/internal/types/config.go
@@ -94,10 +94,6 @@ type Config struct {
CLIUpdateChannel string `yaml:"cli_update_channel,omitempty" mapstructure:"cli_update_channel"`
// Pagination contains global and per-resource pagination configuration.
Pagination PaginationConfig `yaml:"pagination,omitempty" mapstructure:"pagination"`
- // DefaultLimit is a legacy global default list limit for paginated resources.
- DefaultLimit int `yaml:"default_limit,omitempty" mapstructure:"default_limit"`
- // ResourceLimits is a legacy map of per-resource list limits.
- ResourceLimits map[string]int `yaml:"resource_limits,omitempty" mapstructure:"resource_limits"`
}
// HasAuth returns true if either an API key or JWT token is configured.
@@ -140,10 +136,6 @@ func (c *Config) Clone() *Config {
return nil
}
out := *c
- if c.ResourceLimits != nil {
- out.ResourceLimits = make(map[string]int, len(c.ResourceLimits))
- maps.Copy(out.ResourceLimits, c.ResourceLimits)
- }
if c.Pagination.Resources != nil {
out.Pagination.Resources = make(map[string]PaginationResourceConfig, len(c.Pagination.Resources))
maps.Copy(out.Pagination.Resources, c.Pagination.Resources)
@@ -151,7 +143,7 @@ func (c *Config) Clone() *Config {
return &out
}
-// LimitFor returns the configured limit for a resource, falling back to DefaultLimit.
+// LimitFor returns the configured limit for a resource, falling back to the global default.
func (c *Config) LimitFor(resource string) int {
if c == nil {
return 0
@@ -165,16 +157,6 @@ func (c *Config) LimitFor(resource string) int {
if c.Pagination.Default.Limit > 0 {
return c.Pagination.Default.Limit
}
-
- // Backward-compatibility with legacy keys.
- if resource != "" && c.ResourceLimits != nil {
- if v, ok := c.ResourceLimits[resource]; ok && v > 0 {
- return v
- }
- }
- if c.DefaultLimit > 0 {
- return c.DefaultLimit
- }
return 0
}
@@ -184,8 +166,6 @@ func (c *Config) SetDefaultLimit(limit int) {
return
}
c.Pagination.Default.Limit = limit
- // Keep legacy field in sync for compatibility.
- c.DefaultLimit = limit
}
// SetResourceLimit configures per-resource pagination defaults.
@@ -200,15 +180,9 @@ func (c *Config) SetResourceLimit(resource string, limit int) {
if c.Pagination.Resources == nil {
c.Pagination.Resources = make(map[string]PaginationResourceConfig)
}
- if c.ResourceLimits == nil {
- c.ResourceLimits = make(map[string]int)
- }
if limit <= 0 {
delete(c.Pagination.Resources, resource)
- delete(c.ResourceLimits, resource)
return
}
c.Pagination.Resources[resource] = PaginationResourceConfig{Limit: limit}
- // Keep legacy field in sync for compatibility.
- c.ResourceLimits[resource] = limit
}
diff --git a/cli/internal/types/endpoints.go b/cli/internal/types/endpoints.go
index 91d8f1418..a8b273084 100644
--- a/cli/internal/types/endpoints.go
+++ b/cli/internal/types/endpoints.go
@@ -106,8 +106,6 @@ type ArcaneApiEndpoints struct {
SettingsPublicEndpoint string
// Notifications
- NotificationsAppriseEndpoint string
- NotificationsAppriseTestEndpoint string
NotificationsSettingsEndpoint string
NotificationSettingsProviderEndpoint string
NotificationsTestProviderEndpoint string
@@ -269,8 +267,6 @@ var Endpoints = ArcaneApiEndpoints{ //nolint:gosec // static endpoint paths; aut
SettingsPublicEndpoint: "/api/environments/%s/settings/public",
// Notifications
- NotificationsAppriseEndpoint: "/api/environments/%s/notifications/apprise",
- NotificationsAppriseTestEndpoint: "/api/environments/%s/notifications/apprise/test",
NotificationsSettingsEndpoint: "/api/environments/%s/notifications/settings",
NotificationSettingsProviderEndpoint: "/api/environments/%s/notifications/settings/%s",
NotificationsTestProviderEndpoint: "/api/environments/%s/notifications/test/%s",
@@ -580,14 +576,6 @@ func (e ArcaneApiEndpoints) SettingsPublic(envID string) string {
}
// Notification endpoints
-func (e ArcaneApiEndpoints) NotificationsApprise(envID string) string {
- return fmt.Sprintf(e.NotificationsAppriseEndpoint, envID)
-}
-
-func (e ArcaneApiEndpoints) NotificationsAppriseTest(envID string) string {
- return fmt.Sprintf(e.NotificationsAppriseTestEndpoint, envID)
-}
-
func (e ArcaneApiEndpoints) NotificationsSettings(envID string) string {
return fmt.Sprintf(e.NotificationsSettingsEndpoint, envID)
}
diff --git a/cli/pkg/admin/notifications/cmd.go b/cli/pkg/admin/notifications/cmd.go
index 78f8df9c5..16548140f 100644
--- a/cli/pkg/admin/notifications/cmd.go
+++ b/cli/pkg/admin/notifications/cmd.go
@@ -25,56 +25,11 @@ var NotificationsCmd = &cobra.Command{
Short: "Manage notifications",
}
-var appriseCmd = &cobra.Command{
- Use: "apprise",
- Short: "Manage Apprise configuration",
-}
-
var settingsCmd = &cobra.Command{
Use: "settings",
Short: "Manage notification settings",
}
-var appriseGetCmd = &cobra.Command{
- Use: "get",
- Short: "Get Apprise configuration",
- SilenceUsage: true,
- RunE: func(cmd *cobra.Command, args []string) error {
- c, err := client.NewFromConfig()
- if err != nil {
- return err
- }
-
- resp, err := c.Get(cmd.Context(), types.Endpoints.NotificationsApprise(c.EnvID()))
- if err != nil {
- return fmt.Errorf("failed to get apprise config: %w", err)
- }
- defer func() { _ = resp.Body.Close() }()
-
- var result base.ApiResponse[notification.AppriseResponse]
- if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
- return fmt.Errorf("failed to parse response: %w", err)
- }
-
- if jsonOutput {
- resultBytes, err := json.MarshalIndent(result.Data, "", " ")
- if err != nil {
- return fmt.Errorf("failed to marshal JSON: %w", err)
- }
- fmt.Println(string(resultBytes))
- return nil
- }
-
- output.Header("Apprise Configuration")
- output.KeyValue("ID", fmt.Sprintf("%d", result.Data.ID))
- output.KeyValue("API URL", result.Data.APIURL)
- output.KeyValue("Enabled", fmt.Sprintf("%t", result.Data.Enabled))
- output.KeyValue("Image Update Tag", result.Data.ImageUpdateTag)
- output.KeyValue("Container Update Tag", result.Data.ContainerUpdateTag)
- return nil
- },
-}
-
var settingsGetCmd = &cobra.Command{
Use: "get",
Short: "Get notification settings",
@@ -121,40 +76,6 @@ var settingsGetCmd = &cobra.Command{
},
}
-var appriseTestCmd = &cobra.Command{
- Use: "test",
- Short: "Test Apprise notification",
- SilenceUsage: true,
- RunE: func(cmd *cobra.Command, args []string) error {
- c, err := client.NewFromConfig()
- if err != nil {
- return err
- }
-
- resp, err := c.Post(cmd.Context(), types.Endpoints.NotificationsAppriseTest(c.EnvID()), nil)
- if err != nil {
- return fmt.Errorf("failed to test apprise: %w", err)
- }
- defer func() { _ = resp.Body.Close() }()
- if err := cmdutil.EnsureSuccessStatus(resp); err != nil {
- return fmt.Errorf("apprise test failed: %w", err)
- }
-
- if jsonOutput {
- var result base.ApiResponse[any]
- if err := json.NewDecoder(resp.Body).Decode(&result); err == nil {
- if resultBytes, err := json.MarshalIndent(result.Data, "", " "); err == nil {
- fmt.Println(string(resultBytes))
- }
- }
- return nil
- }
-
- output.Success("Apprise notification test successful")
- return nil
- },
-}
-
var settingsDeleteCmd = &cobra.Command{
Use: "delete <provider>",
Short: "Delete notification provider settings",
@@ -227,18 +148,12 @@ var testProviderCmd = &cobra.Command{
}
func init() {
- NotificationsCmd.AddCommand(appriseCmd)
NotificationsCmd.AddCommand(settingsCmd)
NotificationsCmd.AddCommand(testProviderCmd)
- appriseCmd.AddCommand(appriseGetCmd)
- appriseCmd.AddCommand(appriseTestCmd)
-
settingsCmd.AddCommand(settingsGetCmd)
settingsCmd.AddCommand(settingsDeleteCmd)
- appriseGetCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")
- appriseTestCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")
settingsGetCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")
settingsDeleteCmd.Flags().BoolVarP(&notifForceFlag, "force", "f", false, "Force deletion without confirmation")
settingsDeleteCmd.Flags().BoolVar(&jsonOutput, "json", false, "Output in JSON format")
diff --git a/cli/pkg/config/cmd.go b/cli/pkg/config/cmd.go
index f84d747a4..bf2a33103 100644
--- a/cli/pkg/config/cmd.go
+++ b/cli/pkg/config/cmd.go
@@ -49,11 +49,7 @@ var configShowCmd = &cobra.Command{
fmt.Printf("Default Environment: %s\n", maskIfEmpty(cfg.DefaultEnvironment, "0 (local)"))
fmt.Printf("Log Level: %s\n", maskIfEmpty(cfg.LogLevel, "info (default)"))
fmt.Printf("CLI Update Channel: %s\n", maskIfEmpty(cfg.CLIUpdateChannel, "(auto)"))
- globalLimit := cfg.Pagination.Default.Limit
- if globalLimit <= 0 {
- globalLimit = cfg.DefaultLimit
- }
- fmt.Printf("Pagination Default: %s\n", maskIfEmpty(intToString(globalLimit), "(not set)"))
+ fmt.Printf("Pagination Default: %s\n", maskIfEmpty(intToString(cfg.Pagination.Default.Limit), "(not set)"))
fmt.Println("\nPagination Resources:")
printed := 0
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index a143749ad..cbb073dc0 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -2172,7 +2172,6 @@
"notifications_title": "Notifications",
"notifications_description": "Configure notifications for container updates",
"notifications_tab_built_in": "Built-in Notifications",
- "notifications_tab_apprise": "Apprise",
"notifications_read_only_title": "Read-only Mode",
"notifications_read_only_description": "Settings are read-only in this environment. Configuration changes are disabled.",
"notifications_discord_title": "Discord",
@@ -2242,18 +2241,6 @@
"notifications_test_vulnerability_notification": "Test Vulnerability Notification",
"notifications_test_prune_report_notification": "Test Prune Report Notification",
"notifications_test_auto_heal_notification": "Test Auto-Heal Notification",
- "notifications_apprise_title": "Apprise Integration",
- "notifications_apprise_description": "Configure Apprise API for unified notifications across multiple services",
- "notifications_apprise_enabled_label": "Enable Apprise",
- "notifications_apprise_api_url_label": "Apprise API URL",
- "notifications_apprise_api_url_placeholder": "http://localhost:8000/notify",
- "notifications_apprise_api_url_help": "URL of your Apprise API endpoint",
- "notifications_apprise_image_tag_label": "Image Update Tag",
- "notifications_apprise_image_tag_placeholder": "image-updates",
- "notifications_apprise_image_tag_help": "Optional tag for image update notifications",
- "notifications_apprise_container_tag_label": "Container Update Tag",
- "notifications_apprise_container_tag_placeholder": "container-updates",
- "notifications_apprise_container_tag_help": "Optional tag for container update notifications",
"notifications_signal_title": "Signal Notifications",
"notifications_signal_description": "Send notifications via Signal Messenger through a Signal API server",
"notifications_signal_enabled_label": "Enable Signal Notifications",
diff --git a/frontend/src/lib/components/action-buttons.svelte b/frontend/src/lib/components/action-buttons.svelte
index 225b11307..c90836b8b 100644
--- a/frontend/src/lib/components/action-buttons.svelte
+++ b/frontend/src/lib/components/action-buttons.svelte
@@ -235,22 +235,11 @@
update();
- if ('addEventListener' in mqlXl) {
- mqlXl.addEventListener('change', update);
- mqlLg.addEventListener('change', update);
- return () => {
- mqlXl.removeEventListener('change', update);
- mqlLg.removeEventListener('change', update);
- };
- }
-
- // @ts-expect-error legacy MediaQueryList API
- mqlXl.addListener(update);
- mqlLg.addListener(update);
+ mqlXl.addEventListener('change', update);
+ mqlLg.addEventListener('change', update);
return () => {
- // @ts-expect-error legacy MediaQueryList API
- mqlXl.removeListener(update);
- mqlLg.removeListener(update);
+ mqlXl.removeEventListener('change', update);
+ mqlLg.removeEventListener('change', update);
};
});
diff --git a/frontend/src/lib/services/notification-service.ts b/frontend/src/lib/services/notification-service.ts
index 4addd2d85..d40f8acad 100644
--- a/frontend/src/lib/services/notification-service.ts
+++ b/frontend/src/lib/services/notification-service.ts
@@ -1,5 +1,5 @@
import BaseAPIService from './api-service';
-import type { NotificationSettings, TestNotificationResponse, AppriseSettings } from '$lib/types/notification.type';
+import type { NotificationSettings, TestNotificationResponse } from '$lib/types/notification.type';
import { environmentStore } from '$lib/stores/environment.store.svelte';
export default class NotificationService extends BaseAPIService {
@@ -22,23 +22,6 @@ export default class NotificationService extends BaseAPIService {
const encodedType = encodeURIComponent(type);
return this.handleResponse(this.api.post(`/environments/${envId}/notifications/test/${provider}?type=${encodedType}`));
}
-
- async getAppriseSettings(environmentId?: string): Promise<AppriseSettings> {
- const envId = environmentId || (await environmentStore.getCurrentEnvironmentId());
- const res = await this.api.get(`/environments/${envId}/notifications/apprise`);
- return res.data;
- }
-
- async updateAppriseSettings(settings: AppriseSettings): Promise<AppriseSettings> {
- const envId = await environmentStore.getCurrentEnvironmentId();
- const res = await this.api.post(`/environments/${envId}/notifications/apprise`, settings);
- return res.data;
- }
-
- async testAppriseNotification(type: string = 'simple'): Promise<TestNotificationResponse> {
- const envId = await environmentStore.getCurrentEnvironmentId();
- return this.handleResponse(this.api.post(`/environments/${envId}/notifications/apprise/test?type=${type}`));
- }
}
export const notificationService = new NotificationService();
diff --git a/frontend/src/lib/types/container.type.ts b/frontend/src/lib/types/container.type.ts
index 310b12217..0e99f86d9 100644
--- a/frontend/src/lib/types/container.type.ts
+++ b/frontend/src/lib/types/container.type.ts
@@ -140,14 +140,9 @@ export interface ContainerStatusCounts {
export interface ContainerHealthLogEntry {
start?: string;
- // Legacy PascalCase, kept for backwards-compat with older payloads.
- Start?: string;
end?: string;
- End?: string;
exitCode?: number;
- ExitCode?: number;
output?: string;
- Output?: string;
}
export interface ContainerHealthDto {
diff --git a/frontend/src/lib/types/notification-providers.ts b/frontend/src/lib/types/notification-providers.ts
index 7f57e5b2b..1ee01d281 100644
--- a/frontend/src/lib/types/notification-providers.ts
+++ b/frontend/src/lib/types/notification-providers.ts
@@ -1,4 +1,4 @@
-import type { NotificationSettings, AppriseSettings, EmailTLSMode, EmailAuthMode } from './notification.type';
+import type { NotificationSettings, EmailTLSMode, EmailAuthMode } from './notification.type';
// Provider keys - this is the source of truth for all providers (alphabetically sorted)
export const NOTIFICATION_PROVIDER_KEYS = [
@@ -124,13 +124,6 @@ export interface GenericFormValues extends BaseProviderFormValues {
customHeaders: string;
}
-export interface AppriseFormValues {
- enabled: boolean;
- apiUrl: string;
- imageUpdateTag: string;
- containerUpdateTag: string;
-}
-
// Map provider keys to their form value types
export type ProviderFormValuesMap = {
discord: DiscordFormValues;
@@ -279,15 +272,6 @@ export function slackSettingsToFormValues(settings?: NotificationSettings): Slac
};
}
-export function appriseSettingsToFormValues(settings?: AppriseSettings): AppriseFormValues {
- return {
- enabled: settings?.enabled ?? false,
- apiUrl: settings?.apiUrl || '',
- imageUpdateTag: settings?.imageUpdateTag || '',
- containerUpdateTag: settings?.containerUpdateTag || ''
- };
-}
-
// Helper to convert form values back to API format
export function discordFormValuesToSettings(values: DiscordFormValues): NotificationSettings {
return {
@@ -634,12 +618,3 @@ export function genericFormValuesToSettings(values: GenericFormValues): Notifica
}
};
}
-
-export function appriseFormValuesToSettings(values: AppriseFormValues): AppriseSettings {
- return {
- enabled: values.enabled,
- apiUrl: values.apiUrl,
- imageUpdateTag: values.imageUpdateTag,
- containerUpdateTag: values.containerUpdateTag
- };
-}
diff --git a/frontend/src/lib/types/notification.type.ts b/frontend/src/lib/types/notification.type.ts
index 4928436a5..7bcc35a1e 100644
--- a/frontend/src/lib/types/notification.type.ts
+++ b/frontend/src/lib/types/notification.type.ts
@@ -18,14 +18,6 @@ export interface NotificationSettings {
config?: Record<string, any>;
}
-export interface AppriseSettings {
- id?: number;
- apiUrl: string;
- enabled: boolean;
- imageUpdateTag: string;
- containerUpdateTag: string;
-}
-
export interface TestNotificationResponse {
success: boolean;
message?: string;
diff --git a/frontend/src/routes/(app)/containers/components/ContainerHealthcheck.svelte b/frontend/src/routes/(app)/containers/components/ContainerHealthcheck.svelte
index 52d4bd225..9c6765356 100644
--- a/frontend/src/routes/(app)/containers/components/ContainerHealthcheck.svelte
+++ b/frontend/src/routes/(app)/containers/components/ContainerHealthcheck.svelte
@@ -38,15 +38,14 @@
return isNaN(d.getTime()) ? null : d;
}
- // Normalize log entry casing (backend now emits lowercase; tolerate older PascalCase).
function normalizeLog(entries: ContainerHealthLogEntry[] | undefined) {
if (!entries) return [];
return entries
.map((e) => ({
- start: parseDockerDate(e.start ?? e.Start),
- end: parseDockerDate(e.end ?? e.End),
- exitCode: (e.exitCode ?? e.ExitCode ?? 0) as number,
- output: (e.output ?? e.Output ?? '') as string
+ start: parseDockerDate(e.start),
+ end: parseDockerDate(e.end),
+ exitCode: (e.exitCode ?? 0) as number,
+ output: (e.output ?? '') as string
}))
.filter((e) => e.start || e.end);
}
diff --git a/frontend/src/routes/(app)/images/builds/+page.svelte b/frontend/src/routes/(app)/images/builds/+page.svelte
index 2f49df5a1..8c1ef8bb9 100644
--- a/frontend/src/routes/(app)/images/builds/+page.svelte
+++ b/frontend/src/routes/(app)/images/builds/+page.svelte
@@ -431,17 +431,8 @@
update();
- if ('addEventListener' in mq) {
- mq.addEventListener('change', update);
- return () => mq.removeEventListener('change', update);
- }
-
- // @ts-expect-error legacy MediaQueryList API
- mq.addListener(update);
- return () => {
- // @ts-expect-error legacy MediaQueryList API
- mq.removeListener(update);
- };
+ mq.addEventListener('change', update);
+ return () => mq.removeEventListener('change', update);
});
$effect(() => {
diff --git a/frontend/src/routes/(app)/settings/notifications/+page.svelte b/frontend/src/routes/(app)/settings/notifications/+page.svelte
index d2c084c62..da8607888 100644
--- a/frontend/src/routes/(app)/settings/notifications/+page.svelte
+++ b/frontend/src/routes/(app)/settings/notifications/+page.svelte
@@ -1,5 +1,4 @@
<script lang="ts">
- import * as Alert from '$lib/components/ui/alert';
import * as Tabs from '$lib/components/ui/tabs';
import * as Dialog from '$lib/components/ui/dialog';
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
@@ -21,7 +20,6 @@
type GotifyFormValues,
type MatrixFormValues,
type GenericFormValues,
- type AppriseFormValues,
type NotificationProviderKey,
NOTIFICATION_PROVIDER_KEYS,
discordSettingsToFormValues,
@@ -34,7 +32,6 @@
gotifySettingsToFormValues,
matrixSettingsToFormValues,
genericSettingsToFormValues,
- appriseSettingsToFormValues,
discordFormValuesToSettings,
emailFormValuesToSettings,
telegramFormValuesToSettings,
@@ -44,11 +41,10 @@
pushoverFormValuesToSettings,
gotifyFormValuesToSettings,
matrixFormValuesToSettings,
- genericFormValuesToSettings,
- appriseFormValuesToSettings
+ genericFormValuesToSettings
} from '$lib/types/notification-providers';
import { NotificationsIcon } from '$lib/icons';
- import { BuiltInProviderForm, AppriseProviderForm } from './providers';
+ import { BuiltInProviderForm } from './providers';
let { data } = $props();
@@ -57,7 +53,6 @@
let isTesting = $state(false);
let showUnsavedDialog = $state(false);
let pendingTestAction: (() => Promise<void>) | null = $state(null);
- let notificationsTab = $state<'built-in' | 'apprise'>('built-in');
let providerTab = $state<NotificationProviderKey>('email');
const isReadOnly = $derived.by(() => $settingsStore.uiConfigDisabled);
@@ -107,7 +102,6 @@
let gotifyValues = $state<GotifyFormValues>(gotifySettingsToFormValues());
let matrixValues = $state<MatrixFormValues>(matrixSettingsToFormValues());
let genericValues = $state<GenericFormValues>(genericSettingsToFormValues());
- let appriseValues = $state<AppriseFormValues>(appriseSettingsToFormValues());
// Baseline values - what was last saved (for change detection)
let emailBaseline = $state<EmailFormValues>(emailSettingsToFormValues());
@@ -120,7 +114,6 @@
let gotifyBaseline = $state<GotifyFormValues>(gotifySettingsToFormValues());
let matrixBaseline = $state<MatrixFormValues>(matrixSettingsToFormValues());
let genericBaseline = $state<GenericFormValues>(genericSettingsToFormValues());
- let appriseBaseline = $state<AppriseFormValues>(appriseSettingsToFormValues());
// Change detection
const emailHasChanges = $derived(JSON.stringify(emailValues) !== JSON.stringify(emailBaseline));
@@ -133,7 +126,6 @@
const gotifyHasChanges = $derived(JSON.stringify(gotifyValues) !== JSON.stringify(gotifyBaseline));
const matrixHasChanges = $derived(JSON.stringify(matrixValues) !== JSON.stringify(matrixBaseline));
const genericHasChanges = $derived(JSON.stringify(genericValues) !== JSON.stringify(genericBaseline));
- const appriseHasChanges = $derived(JSON.stringify(appriseValues) !== JSON.stringify(appriseBaseline));
const hasChanges = $derived(
emailHasChanges ||
discordHasChanges ||
@@ -144,8 +136,7 @@
pushoverHasChanges ||
gotifyHasChanges ||
matrixHasChanges ||
- genericHasChanges ||
- appriseHasChanges
+ genericHasChanges
);
// Sync with settings form context
@@ -196,15 +187,6 @@
genericValues = genericSettingsToFormValues(savedSettings.generic ?? undefined);
genericBaseline = { ...genericValues };
-
- // Load Apprise settings
- try {
- const settings = await notificationService.getAppriseSettings();
- appriseValues = appriseSettingsToFormValues(settings);
- appriseBaseline = { ...appriseValues };
- } catch {
- // Apprise not configured yet, keep defaults
- }
});
async function onSubmit() {
@@ -373,18 +355,6 @@
}
}
- // Save Apprise settings if changed
- if (appriseHasChanges) {
- try {
- const settings = appriseFormValuesToSettings(appriseValues);
- await notificationService.updateAppriseSettings(settings);
- appriseBaseline = { ...appriseValues };
- } catch (error: any) {
- const errorMsg = error?.response?.data?.error || error.message || m.common_unknown();
- errors.push(m.notifications_saved_failed({ provider: 'Apprise', error: errorMsg }));
- }
- }
-
if (errors.length === 0) {
toast.success(m.general_settings_saved());
} else {
@@ -409,7 +379,6 @@
gotifyValues = { ...gotifyBaseline };
matrixValues = { ...matrixBaseline };
genericValues = { ...genericBaseline };
- appriseValues = { ...appriseBaseline };
}
async function testNotification(provider: NotificationProviderKey, testType: string = 'simple') {
@@ -434,28 +403,6 @@
}
}
- async function testAppriseNotification(testType: string = 'simple') {
- if (hasChanges) {
- pendingTestAction = () => executeAppriseTest(testType);
- showUnsavedDialog = true;
- return;
- }
- await executeAppriseTest(testType);
- }
-
- async function executeAppriseTest(testType: string = 'simple') {
- isTesting = true;
- try {
- await notificationService.testAppriseNotification(testType);
- toast.success(m.notifications_test_success({ provider: 'Apprise' }));
- } catch (error: any) {
- const errorMsg = error?.response?.data?.error || error.message || m.common_unknown();
- toast.error(m.notifications_test_failed({ error: errorMsg }));
- } finally {
- isTesting = false;
- }
- }
-
async function handleSaveAndTest() {
showUnsavedDialog = false;
await onSubmit();
@@ -475,146 +422,123 @@
>
{#snippet mainContent()}
<fieldset disabled={isReadOnly} class="relative w-full min-w-0">
- <Tabs.Root bind:value={notificationsTab}>
- <Tabs.List class="inline-flex w-auto">
- <Tabs.Trigger value="built-in">{m.notifications_tab_built_in()}</Tabs.Trigger>
- <Tabs.Trigger value="apprise">{m.notifications_tab_apprise()}</Tabs.Trigger>
+ <Tabs.Root bind:value={providerTab} class="flex min-h-0 w-full min-w-0 flex-col">
+ <Tabs.List class="scrollbar-hide flex w-full max-w-full justify-start gap-4 overflow-x-auto">
+ {#each NOTIFICATION_PROVIDER_KEYS as provider (provider)}
+ <Tabs.Trigger value={provider} class="shrink-0">
+ {provider.charAt(0).toUpperCase() + provider.slice(1)}
+ </Tabs.Trigger>
+ {/each}
</Tabs.List>
- <Tabs.Content value="built-in" class="mt-4 sm:mt-6">
- <div class="space-y-8">
- <Tabs.Root bind:value={providerTab} class="flex min-h-0 w-full min-w-0 flex-col">
- <Tabs.List class="scrollbar-hide flex w-full max-w-full justify-start gap-4 overflow-x-auto">
- {#each NOTIFICATION_PROVIDER_KEYS as provider (provider)}
- <Tabs.Trigger value={provider} class="shrink-0">
- {provider.charAt(0).toUpperCase() + provider.slice(1)}
- </Tabs.Trigger>
- {/each}
- </Tabs.List>
-
- <Tabs.Content value="email" class="mt-4 space-y-4">
- <BuiltInProviderForm
- bind:this={emailFormRef}
- provider="email"
- bind:values={emailValues}
- disabled={isReadOnly}
- {isTesting}
- onTest={(testType) => testNotification('email', testType)}
- />
- </Tabs.Content>
-
- <Tabs.Content value="discord" class="mt-4 space-y-4">
- <BuiltInProviderForm
- bind:this={discordFormRef}
- provider="discord"
- bind:values={discordValues}
- disabled={isReadOnly}
- {isTesting}
- onTest={(testType) => testNotification('discord', testType)}
- />
- </Tabs.Content>
-
- <Tabs.Content value="telegram" class="mt-4 space-y-4">
- <BuiltInProviderForm
- bind:this={telegramFormRef}
- provider="telegram"
- bind:values={telegramValues}
- disabled={isReadOnly}
- {isTesting}
- onTest={(testType) => testNotification('telegram', testType)}
- />
- </Tabs.Content>
-
- <Tabs.Content value="signal" class="mt-4 space-y-4">
- <BuiltInProviderForm
- bind:this={signalFormRef}
- provider="signal"
- bind:values={signalValues}
- disabled={isReadOnly}
- {isTesting}
- onTest={(testType) => testNotification('signal', testType)}
- />
- </Tabs.Content>
-
- <Tabs.Content value="slack" class="mt-4 space-y-4">
- <BuiltInProviderForm
- bind:this={slackFormRef}
- provider="slack"
- bind:values={slackValues}
- disabled={isReadOnly}
- {isTesting}
- onTest={(testType) => testNotification('slack', testType)}
- />
- </Tabs.Content>
-
- <Tabs.Content value="ntfy" class="mt-4 space-y-4">
- <BuiltInProviderForm
- bind:this={ntfyFormRef}
- provider="ntfy"
- bind:values={ntfyValues}
- disabled={isReadOnly}
- {isTesting}
- onTest={(testType) => testNotification('ntfy', testType)}
- />
- </Tabs.Content>
-
- <Tabs.Content value="pushover" class="mt-4 space-y-4">
- <BuiltInProviderForm
- bind:this={pushoverFormRef}
- provider="pushover"
- bind:values={pushoverValues}
- disabled={isReadOnly}
- {isTesting}
- onTest={(testType) => testNotification('pushover', testType)}
- />
- </Tabs.Content>
-
- <Tabs.Content value="gotify" class="mt-4 space-y-4">
- <BuiltInProviderForm
- bind:this={gotifyFormRef}
- provider="gotify"
- bind:values={gotifyValues}
- disabled={isReadOnly}
- {isTesting}
- onTest={(testType) => testNotification('gotify', testType)}
- />
- </Tabs.Content>
-
- <Tabs.Content value="matrix" class="mt-4 space-y-4">
- <BuiltInProviderForm
- bind:this={matrixFormRef}
- provider="matrix"
- bind:values={matrixValues}
- disabled={isReadOnly}
- {isTesting}
- onTest={(testType) => testNotification('matrix', testType)}
- />
- </Tabs.Content>
-
- <Tabs.Content value="generic" class="mt-4 space-y-4">
- <BuiltInProviderForm
- bind:this={genericFormRef}
- provider="generic"
- bind:values={genericValues}
- disabled={isReadOnly}
- {isTesting}
- onTest={(testType) => testNotification('generic', testType)}
- />
- </Tabs.Content>
- </Tabs.Root>
- </div>
+ <Tabs.Content value="email" class="mt-4 space-y-4">
+ <BuiltInProviderForm
+ bind:this={emailFormRef}
+ provider="email"
+ bind:values={emailValues}
+ disabled={isReadOnly}
+ {isTesting}
+ onTest={(testType) => testNotification('email', testType)}
+ />
+ </Tabs.Content>
+
+ <Tabs.Content value="discord" class="mt-4 space-y-4">
+ <BuiltInProviderForm
+ bind:this={discordFormRef}
+ provider="discord"
+ bind:values={discordValues}
+ disabled={isReadOnly}
+ {isTesting}
+ onTest={(testType) => testNotification('discord', testType)}
+ />
+ </Tabs.Content>
+
+ <Tabs.Content value="telegram" class="mt-4 space-y-4">
+ <BuiltInProviderForm
+ bind:this={telegramFormRef}
+ provider="telegram"
+ bind:values={telegramValues}
+ disabled={isReadOnly}
+ {isTesting}
+ onTest={(testType) => testNotification('telegram', testType)}
+ />
+ </Tabs.Content>
+
+ <Tabs.Content value="signal" class="mt-4 space-y-4">
+ <BuiltInProviderForm
+ bind:this={signalFormRef}
+ provider="signal"
+ bind:values={signalValues}
+ disabled={isReadOnly}
+ {isTesting}
+ onTest={(testType) => testNotification('signal', testType)}
+ />
</Tabs.Content>
- <Tabs.Content value="apprise" class="mt-4 space-y-4 sm:mt-6 sm:space-y-6">
- <Alert.Root variant="default" class="border-yellow-500/50 bg-yellow-500/10 text-yellow-600 dark:text-yellow-400">
- <Alert.Title>Deprecated</Alert.Title>
- <Alert.Description>
- Apprise support is deprecated and will be removed in a future release. Please migrate to the built-in notification
- providers.
- </Alert.Description>
- </Alert.Root>
+ <Tabs.Content value="slack" class="mt-4 space-y-4">
+ <BuiltInProviderForm
+ bind:this={slackFormRef}
+ provider="slack"
+ bind:values={slackValues}
+ disabled={isReadOnly}
+ {isTesting}
+ onTest={(testType) => testNotification('slack', testType)}
+ />
+ </Tabs.Content>
+
+ <Tabs.Content value="ntfy" class="mt-4 space-y-4">
+ <BuiltInProviderForm
+ bind:this={ntfyFormRef}
+ provider="ntfy"
+ bind:values={ntfyValues}
+ disabled={isReadOnly}
+ {isTesting}
+ onTest={(testType) => testNotification('ntfy', testType)}
+ />
+ </Tabs.Content>
+
+ <Tabs.Content value="pushover" class="mt-4 space-y-4">
+ <BuiltInProviderForm
+ bind:this={pushoverFormRef}
+ provider="pushover"
+ bind:values={pushoverValues}
+ disabled={isReadOnly}
+ {isTesting}
+ onTest={(testType) => testNotification('pushover', testType)}
+ />
+ </Tabs.Content>
+
+ <Tabs.Content value="gotify" class="mt-4 space-y-4">
+ <BuiltInProviderForm
+ bind:this={gotifyFormRef}
+ provider="gotify"
+ bind:values={gotifyValues}
+ disabled={isReadOnly}
+ {isTesting}
+ onTest={(testType) => testNotification('gotify', testType)}
+ />
+ </Tabs.Content>
+
+ <Tabs.Content value="matrix" class="mt-4 space-y-4">
+ <BuiltInProviderForm
+ bind:this={matrixFormRef}
+ provider="matrix"
+ bind:values={matrixValues}
+ disabled={isReadOnly}
+ {isTesting}
+ onTest={(testType) => testNotification('matrix', testType)}
+ />
+ </Tabs.Content>
- <AppriseProviderForm bind:values={appriseValues} disabled={isReadOnly} {isTesting} onTest={testAppriseNotification} />
+ <Tabs.Content value="generic" class="mt-4 space-y-4">
+ <BuiltInProviderForm
+ bind:this={genericFormRef}
+ provider="generic"
+ bind:values={genericValues}
+ disabled={isReadOnly}
+ {isTesting}
+ onTest={(testType) => testNotification('generic', testType)}
+ />
</Tabs.Content>
</Tabs.Root>
</fieldset>
diff --git a/frontend/src/routes/(app)/settings/notifications/providers/AppriseProviderForm.svelte b/frontend/src/routes/(app)/settings/notifications/providers/AppriseProviderForm.svelte
deleted file mode 100644
index 879601dc3..000000000
--- a/frontend/src/routes/(app)/settings/notifications/providers/AppriseProviderForm.svelte
+++ /dev/null
@@ -1,62 +0,0 @@
-<script lang="ts">
- import { m } from '$lib/paraglide/messages';
- import type { AppriseFormValues } from '$lib/types/notification-providers';
- import ProviderFormWrapper from './ProviderFormWrapper.svelte';
- import DynamicProviderFormBuilder from './DynamicProviderFormBuilder.svelte';
- import NotificationProviderTestMenu from './NotificationProviderTestMenu.svelte';
- import type { ProviderFormSchema } from './provider-form-schema';
-
- interface Props {
- values: AppriseFormValues;
- disabled?: boolean;
- isTesting?: boolean;
- onTest?: (testType?: string) => void;
- }
-
- let { values = $bindable(), disabled = false, isTesting = false, onTest }: Props = $props();
-
- const formSchema: ProviderFormSchema<AppriseFormValues> = [
- {
- kind: 'input',
- key: 'apiUrl',
- id: 'apprise-api-url',
- label: m.notifications_apprise_api_url_label(),
- placeholder: m.notifications_apprise_api_url_placeholder(),
- helpText: m.notifications_apprise_api_url_help(),
- inputType: 'url'
- },
- {
- kind: 'input',
- key: 'imageUpdateTag',
- id: 'apprise-image-update-tag',
- label: m.notifications_apprise_image_tag_label(),
- placeholder: m.notifications_apprise_image_tag_placeholder(),
- helpText: m.notifications_apprise_image_tag_help()
- },
- {
- kind: 'input',
- key: 'containerUpdateTag',
- id: 'apprise-container-update-tag',
- label: m.notifications_apprise_container_tag_label(),
- placeholder: m.notifications_apprise_container_tag_placeholder(),
- helpText: m.notifications_apprise_container_tag_help()
- }
- ];
-
- export function isValid(): boolean {
- if (!values.enabled) return true;
- return values.apiUrl.trim().length > 0;
- }
-</script>
-
-<ProviderFormWrapper
- id="apprise"
- title={m.notifications_apprise_title()}
- description={m.notifications_apprise_description()}
- bind:enabled={values.enabled}
- {disabled}
->
- <DynamicProviderFormBuilder bind:values {disabled} schema={formSchema} />
-
- <NotificationProviderTestMenu {disabled} {isTesting} {onTest} />
-</ProviderFormWrapper>
diff --git a/frontend/src/routes/(app)/settings/notifications/providers/index.ts b/frontend/src/routes/(app)/settings/notifications/providers/index.ts
index d508d18c4..9a91f3d60 100644
--- a/frontend/src/routes/(app)/settings/notifications/providers/index.ts
+++ b/frontend/src/routes/(app)/settings/notifications/providers/index.ts
@@ -1,4 +1,3 @@
-export { default as AppriseProviderForm } from './AppriseProviderForm.svelte';
export { default as BuiltInProviderForm } from './BuiltInProviderForm.svelte';
export { default as ProviderFormWrapper } from './ProviderFormWrapper.svelte';
export { default as EventSubscriptions } from './EventSubscriptions.svelte';
diff --git a/tests/spec/cli.spec.ts b/tests/spec/cli.spec.ts
index 2e244bf90..85f678be8 100644
--- a/tests/spec/cli.spec.ts
+++ b/tests/spec/cli.spec.ts
@@ -189,13 +189,6 @@ const readOnlyJsonSmokeCommands: JsonSmokeCommand[] = [
args: ['admin', 'events', 'list-env', '--limit', '5', '--json'],
expectation: expectPaginated
},
- {
- name: 'admin notifications apprise get',
- args: ['admin', 'notifications', 'apprise', 'get', '--json'],
- expectation: (value) => {
- expect(value).toEqual(expect.objectContaining({ enabled: expect.any(Boolean) }));
- }
- },
{
name: 'admin notifications settings get',
args: ['admin', 'notifications', 'settings', 'get', '--json'],
diff --git a/tests/spec/settings-notifications.spec.ts b/tests/spec/settings-notifications.spec.ts
index 86c19baad..e9810bf10 100644
--- a/tests/spec/settings-notifications.spec.ts
+++ b/tests/spec/settings-notifications.spec.ts
@@ -65,19 +65,6 @@ test.describe('Notification settings', () => {
await route.continue();
});
- await page.route('**/api/environments/*/notifications/apprise', async (route) => {
- if (route.request().method() === 'GET') {
- await route.fulfill({
- status: 404,
- contentType: 'application/json',
- body: JSON.stringify({ error: 'not configured' })
- });
- return;
- }
-
- await route.continue();
- });
-
// Stub the specific test endpoint
await page.route(`**/api/environments/*/notifications/test/${provider}**`, async (route) => {
testEndpointCalled = true;
@@ -90,7 +77,6 @@ test.describe('Notification settings', () => {
await page.goto('/settings/notifications');
await page.waitForLoadState('networkidle');
- await expect(page.getByRole('tab', { name: 'Built-in Notifications' })).toBeVisible();
await expect(page.getByRole('tab', { name: 'Email' })).toBeVisible();
return {
diff --git a/types/environment/environment.go b/types/environment/environment.go
index 033c61928..6d1fa7090 100644
--- a/types/environment/environment.go
+++ b/types/environment/environment.go
@@ -23,11 +23,6 @@ type Create struct {
// Required: false
AccessToken *string `json:"accessToken,omitempty"` //nolint:gosec // API schema requires accessToken field name
- // BootstrapToken for initial setup of the environment.
- //
- // Required: false
- BootstrapToken *string `json:"bootstrapToken,omitempty"`
-
// UseApiKey indicates if an API key should be generated for pairing.
//
// Required: false
@@ -60,11 +55,6 @@ type Update struct {
// Required: false
AccessToken *string `json:"accessToken,omitempty"` //nolint:gosec // API schema requires accessToken field name
- // BootstrapToken for initial setup of the environment.
- //
- // Required: false
- BootstrapToken *string `json:"bootstrapToken,omitempty"`
-
// RegenerateApiKey indicates whether to regenerate the API key.
//
// Required: false
diff --git a/types/notification/notification.go b/types/notification/notification.go
index fc5079050..7e8d5c1cb 100644
--- a/types/notification/notification.go
+++ b/types/notification/notification.go
@@ -77,55 +77,6 @@ type Response struct {
Config base.JsonObject `json:"config"`
}
-type AppriseUpdate struct {
- // APIURL is the URL of the Apprise API endpoint.
- //
- // Required: false
- APIURL string `json:"apiUrl"`
-
- // Enabled indicates if Apprise is enabled.
- //
- // Required: true
- Enabled bool `json:"enabled"`
-
- // ImageUpdateTag is the tag to use for image update notifications.
- //
- // Required: false
- ImageUpdateTag string `json:"imageUpdateTag"`
-
- // ContainerUpdateTag is the tag to use for container update notifications.
- //
- // Required: false
- ContainerUpdateTag string `json:"containerUpdateTag"`
-}
-
-type AppriseResponse struct {
- // ID is the unique identifier of the Apprise settings.
- //
- // Required: true
- ID uint `json:"id"`
-
- // APIURL is the URL of the Apprise API endpoint.
- //
- // Required: false
- APIURL string `json:"apiUrl"`
-
- // Enabled indicates if Apprise is enabled.
- //
- // Required: true
- Enabled bool `json:"enabled"`
-
- // ImageUpdateTag is the tag to use for image update notifications.
- //
- // Required: false
- ImageUpdateTag string `json:"imageUpdateTag"`
-
- // ContainerUpdateTag is the tag to use for container update notifications.
- //
- // Required: false
- ContainerUpdateTag string `json:"containerUpdateTag"`
-}
-
type DispatchKind string
const (
diff --git a/types/settings/settings.go b/types/settings/settings.go
index 096d5cf7b..c535eb4a1 100644
--- a/types/settings/settings.go
+++ b/types/settings/settings.go
@@ -94,13 +94,6 @@ type Update struct {
// Required: false
EnvironmentHealthInterval *string `json:"environmentHealthInterval,omitempty"`
- // PruneMode is the Docker prune mode ("all" or "dangling").
- //
- // Deprecated: Use the granular prune mode settings instead.
- //
- // Required: false
- PruneMode *string `json:"dockerPruneMode,omitempty" binding:"omitempty,oneof=all dangling"`
-
// DefaultDeployPullPolicy is the default image pull policy used for project deploys.
//
// Required: false
@@ -116,41 +109,6 @@ type Update struct {
// Required: false
ScheduledPruneInterval *string `json:"scheduledPruneInterval,omitempty"`
- // ScheduledPruneContainers indicates if stopped containers should be pruned.
- //
- // Deprecated: Use pruneContainerMode instead.
- //
- // Required: false
- ScheduledPruneContainers *string `json:"scheduledPruneContainers,omitempty"`
-
- // ScheduledPruneImages indicates if unused images should be pruned.
- //
- // Deprecated: Use pruneImageMode instead.
- //
- // Required: false
- ScheduledPruneImages *string `json:"scheduledPruneImages,omitempty"`
-
- // ScheduledPruneVolumes indicates if unused volumes should be pruned.
- //
- // Deprecated: Use pruneVolumeMode instead.
- //
- // Required: false
- ScheduledPruneVolumes *string `json:"scheduledPruneVolumes,omitempty"`
-
- // ScheduledPruneNetworks indicates if unused networks should be pruned.
- //
- // Deprecated: Use pruneNetworkMode instead.
- //
- // Required: false
- ScheduledPruneNetworks *string `json:"scheduledPruneNetworks,omitempty"`
-
- // ScheduledPruneBuildCache indicates if build cache should be pruned.
- //
- // Deprecated: Use pruneBuildCacheMode instead.
- //
- // Required: false
- ScheduledPruneBuildCache *string `json:"scheduledPruneBuildCache,omitempty"`
-
// PruneContainerMode controls how containers are pruned during scheduled prune.
//
// Required: false
@@ -334,11 +292,6 @@ type Update struct {
// Required: false
TrivyConcurrentScanContainers *string `json:"trivyConcurrentScanContainers,omitempty"`
- // AuthOidcConfig is deprecated and will be removed in a future release.
- //
- // Required: false
- AuthOidcConfig *string `json:"authOidcConfig,omitempty"`
-
// OidcClientId is the OIDC client identifier.
//
// Required: false