Skip to content

Conversation

@BobbieGoede
Copy link

Merges the config found in publicRuntimeConfig.firebase with the module options, I don't think this works if you add the module to buildModules.

Adds functionality to compile/generate templates on startup, maybe there is a better way that doesn't require adding lodash and serialize-javascript as dependencies. The compilation also makes the assumption that the nuxt template global is always set to $nuxt, this can probably be cached/saved at build time for accuracy.

For dynamic configs the usage could be as follows

publicRuntimeConfig: { firebase: process.env.CUSTOM_ENV_VARIABLE === 'production' ? // Production config { apiKey: '...', authDomain: '...', projectId: '...', storageBucket: '...', messagingSenderId: '...', appId: '...', measurementId: '...', } : // Development config { apiKey: '...', authDomain: '...', projectId: '...', storageBucket: '...', messagingSenderId: '...', appId: '...', measurementId: '...', }, }

To me this seems a bit easier or more flexible than the customEnv key and the nested environment configs. I suggest removing that approach if this feature gets added as the same can be achieved with runtime config and it could cause confusion/conflicts if nested configs are used in combination with runtime config.

My implementation feels a bit hacky to me, so please let me know if there are any changes to be made! 😄

@BobbieGoede BobbieGoede force-pushed the feature/add-runtime-config-support branch from 5bcf491 to 75f1293 Compare January 17, 2022 11:38
@BobbieGoede BobbieGoede force-pushed the feature/add-runtime-config-support branch 2 times, most recently from 4324cea to 20654fd Compare February 9, 2022 14:55
@BobbieGoede BobbieGoede closed this Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant