Open
Description
Most integratiosn like Cloudflare Web Analytics or Google Analytics seem to be configurable by a very convinient way using .env
file and nuxt config:
export default defineNuxtConfig({
scripts: {
registry: {
googleAnalytics: true,
}
},
runtimeConfig: {
public: {
scripts: {
googleAnalytics: {
id: '', // NUXT_PUBLIC_SCRIPTS_GOOGLE_ANALYTICS_ID
},
},
},
},
})
However other scripts like Google Maps or Stripe require to add the key manually:
Google Maps:
<script setup lang="ts">
const { $script } = useScriptGoogleMaps({
apiKey: 'key' // <---- This shouldnt be needed if configured in runtimeConfig
})
// ...
</script>
Stripe:
<script setup lang="ts">
const { $script } = useScriptStripe()
onMounted(() => {
$script.then(({ Stripe }) => {
const stripe = Stripe('YOUR_STRIPE_KEY'); // <---- This shouldnt be needed if configured in runtimeConfig
// ...
})
})
// ...
</script>
Can we have all integrations configurable with .env and runtime config? Or maybe they are already but it is not documented?