Skip to content

Modern Docker Management, Designed for Everyone

fix: update api url to APP_URL for local environment on each startup

Kyle Mendell96494c916135
diff --git a/backend/internal/services/environment_service.go b/backend/internal/services/environment_service.go
index 8e9558bc0..0a2754875 100644
--- a/backend/internal/services/environment_service.go
+++ b/backend/internal/services/environment_service.go
@@ -42,7 +42,13 @@ func (s *EnvironmentService) EnsureLocalEnvironment(ctx context.Context, appUrl
err := s.db.WithContext(ctx).Where("id = ?", localEnvID).First(&existingEnv).Error
if err == nil {
- // Local environment already exists
+ // Local environment already exists, ensure ApiUrl matches current appUrl
+ if existingEnv.ApiUrl != appUrl {
+ if err := s.db.WithContext(ctx).Model(&existingEnv).Update("api_url", appUrl).Error; err != nil {
+ return fmt.Errorf("failed to update local environment api url: %w", err)
+ }
+ slog.InfoContext(ctx, "updated local environment api url", "id", localEnvID, "url", appUrl)
+ }
return nil
}