TidycodeIT / nuxt3-magento-sdk-storefront

A boilerplate storefront build with the Vue Storefront Magento 2 Integration and Storefront UI
https://vuestorefront.io/
30 stars 4 forks source link

Using Environment Variables inside of sdk.config.ts #38

Open jacobfogolyan opened 10 months ago

jacobfogolyan commented 10 months ago

What is your question / Please describe your issue

Since you would need to add env vars to the sdk.config.ts file, you cannot access environment variables directly. As you probably noticed, you need to add environment variables to your runtimeConfig.public. But since we are locked into this approach, you will need to make this a function to be exported and access const $config = useRuntimeConfig() inside this function.

However the issue with this is, then it can only be called within nuxt context. Which means you need to export a function, not the object. Then of course you need to change all references to this.

What version of Nuxt3-Magento2-Store are you using?

1.0.0

Code of Conduct