set config via feature flags (#6590)

In cloud environment, allow all the config values to be set by the
feature flag endpoint and be updated dynamically (on 30s poll). Retain
origianl behavior for OSS. On cloud, config changes shouldn't be changed
via redeploy and the promoted image should match the staging image.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6590-set-config-via-feature-flags-2a26d73d3650819f8084eb2695c51f22)
by [Unito](https://www.unito.io)

---------

Co-authored-by: DrJKL <DrJKL0424@gmail.com>
This commit is contained in:
Christian Byrne
2025-11-05 12:45:21 -08:00
committed by GitHub
parent 549ef79e02
commit 437c3b2da0
15 changed files with 200 additions and 43 deletions

View File

@@ -21,6 +21,15 @@ import type { RemoteConfig } from './types'
*/
export const remoteConfig = ref<RemoteConfig>({})
export function configValueOrDefault<K extends keyof RemoteConfig>(
remoteConfig: RemoteConfig,
key: K,
defaultValue: NonNullable<RemoteConfig[K]>
): NonNullable<RemoteConfig[K]> {
const configValue = remoteConfig[key]
return configValue || defaultValue
}
/**
* Loads remote configuration from the backend /api/features endpoint
* and updates the reactive remoteConfig ref

View File

@@ -8,6 +8,17 @@ type ServerHealthAlert = {
badge?: string
}
type FirebaseRuntimeConfig = {
apiKey: string
authDomain: string
databaseURL?: string
projectId: string
storageBucket: string
messagingSenderId: string
appId: string
measurementId?: string
}
/**
* Remote configuration type
* Configuration fetched from the server at runtime
@@ -16,4 +27,8 @@ export type RemoteConfig = {
mixpanel_token?: string
subscription_required?: boolean
server_health_alert?: ServerHealthAlert
max_upload_size?: number
comfy_api_base_url?: string
comfy_platform_base_url?: string
firebase_config?: FirebaseRuntimeConfig
}