mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-24 08:19:51 +00:00
change cloud feature flags to be loaded dynamically at runtime rather than set in build (#6246)
## Summary Implements server-side remote configuration to decouple runtime behavior from build artifacts, enabling dynamic configuration updates without redeployment. ## Technical Changes - **Replaced** build-time constants (`__MIXPANEL_TOKEN__`, `__BUILD_FLAGS__`) with runtime configuration loaded from `/api/features` - Configuration now sourced from `window.__CONFIG__` (hydrated from `/api/features` endpoint) - **Added** `src/platform/remoteConfig/` service that polls server configuration every 30 seconds - **Modified** application bootstrap sequence in `main.ts` to load remote config before module initialization (required for cloud builds) - **Removed** global constants: `__BUILD_FLAGS__`, `__MIXPANEL_TOKEN__`. Runtime subscription enforcement toggle via `subscription_required` flag - Server health alerts with variant-based severity rendering (info/warning/error) via topbar badges ## Rationale - **Build-once-deploy-anywhere**: Single immutable artifact promoted through environments (staging → production) - **Zero-downtime configuration**: Update behavior without rebuilding or redeploying the application - **Incident response**: Disable features or display alerts dynamically in response to outages or degraded service - **Instant rollback**: Revert configuration changes server-side without artifact redeployment - **Progressive delivery**: Enable A/B testing, canary releases, and user/region-based configuration - **Environment parity**: Eliminate configuration drift between staging and production builds - Decouples deployment cadence from configuration changes - Enables GitOps workflows for configuration management separate from code deployments - Supports real-time operational control of client behavior - Reduces build matrix complexity (no per-environment builds) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6246-change-cloud-feature-flags-to-be-loaded-dynamically-at-runtime-rather-than-set-in-build-2966d73d3650811cbb41c9093961037a) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -7,6 +7,8 @@ import { useWorkflowTemplatesStore } from '@/platform/workflow/templates/reposit
|
||||
import type {
|
||||
AuthMetadata,
|
||||
ExecutionContext,
|
||||
ExecutionErrorMetadata,
|
||||
ExecutionSuccessMetadata,
|
||||
RunButtonProperties,
|
||||
SurveyResponses,
|
||||
TelemetryEventName,
|
||||
@@ -40,7 +42,7 @@ export class MixpanelTelemetryProvider implements TelemetryProvider {
|
||||
private isInitialized = false
|
||||
|
||||
constructor() {
|
||||
const token = __MIXPANEL_TOKEN__
|
||||
const token = window.__CONFIG__?.mixpanel_token
|
||||
|
||||
if (token) {
|
||||
try {
|
||||
@@ -74,7 +76,7 @@ export class MixpanelTelemetryProvider implements TelemetryProvider {
|
||||
this.isEnabled = false
|
||||
}
|
||||
} else {
|
||||
console.warn('Mixpanel token not provided')
|
||||
console.warn('Mixpanel token not provided in runtime config')
|
||||
this.isEnabled = false
|
||||
}
|
||||
}
|
||||
@@ -178,7 +180,15 @@ export class MixpanelTelemetryProvider implements TelemetryProvider {
|
||||
|
||||
trackWorkflowExecution(): void {
|
||||
const context = this.getExecutionContext()
|
||||
this.trackEvent(TelemetryEvents.WORKFLOW_EXECUTION_STARTED, context)
|
||||
this.trackEvent(TelemetryEvents.EXECUTION_START, context)
|
||||
}
|
||||
|
||||
trackExecutionError(metadata: ExecutionErrorMetadata): void {
|
||||
this.trackEvent(TelemetryEvents.EXECUTION_ERROR, metadata)
|
||||
}
|
||||
|
||||
trackExecutionSuccess(metadata: ExecutionSuccessMetadata): void {
|
||||
this.trackEvent(TelemetryEvents.EXECUTION_SUCCESS, metadata)
|
||||
}
|
||||
|
||||
getExecutionContext(): ExecutionContext {
|
||||
|
||||
Reference in New Issue
Block a user