diff --git a/packages/data-models/deployment.model.ts b/packages/data-models/deployment.model.ts index 776b3771ee..d1c1f40053 100644 --- a/packages/data-models/deployment.model.ts +++ b/packages/data-models/deployment.model.ts @@ -3,7 +3,7 @@ import type { IGdriveEntry } from "../@idemsInternational/gdrive-tools"; import type { IAppConfig, IAppConfigOverride } from "./appConfig"; /** Update version to force recompile next time deployment set (e.g. after default config update) */ -export const DEPLOYMENT_CONFIG_VERSION = 20241215.1; +export const DEPLOYMENT_CONFIG_VERSION = 20250202.0; /** Configuration settings available to runtime application */ export interface IDeploymentRuntimeConfig { @@ -46,9 +46,9 @@ export interface IDeploymentRuntimeConfig { /** * Specify if using firebase for auth and crashlytics. * Requires firebase config available through encrypted config */ - firebase: { + firebase?: { /** Project config as specified in firebase console (recommend loading from encrypted environment) */ - config?: { + config: { apiKey: string; authDomain: string; databaseURL: string; @@ -58,8 +58,8 @@ export interface IDeploymentRuntimeConfig { appId: string; measurementId: string; }; - crashlytics: { - /** Enables app crash reports to firebase crashlytics */ + /** Configure app crash reports to firebase crashlytics */ + crashlytics?: { enabled: boolean; }; }; @@ -204,10 +204,6 @@ export const DEPLOYMENT_RUNTIME_CONFIG_DEFAULTS: IDeploymentRuntimeConfig = { }, app_config: {}, auth: {}, - firebase: { - config: null, - crashlytics: { enabled: true }, - }, supabase: { enabled: false, }, diff --git a/src/app/shared/services/firebase/firebase.service.ts b/src/app/shared/services/firebase/firebase.service.ts index e8ca57e734..8832669ba7 100644 --- a/src/app/shared/services/firebase/firebase.service.ts +++ b/src/app/shared/services/firebase/firebase.service.ts @@ -20,15 +20,14 @@ export class FirebaseService extends SyncServiceBase { private initialise() { const { firebase } = this.deploymentService.config; - // Check if any services are enabled, simply return if not - const enabledServices = Object.entries(firebase) - .filter(([key, v]) => v && v.constructor === {}.constructor && v["enabled"]) - .map(([key]) => key); - if (enabledServices.length === 0) return; + // Skip init if top-level firebase config not provided + if (!firebase) return; - // Check config exists if services are enabled - if (!firebase.config) { - console.warn(`[Firebase] config missing, services disabled:\n`, enabledServices.join(", ")); + // Provide warning if firebase app config not available (e.g. encrypted import failed) + const { config, ...services } = firebase; + if (!config) { + const configuredServices = Object.keys(services).join(", "); + console.warn(`[Firebase] config missing, services disabled:\n`, configuredServices); return; }