-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide/Inject example #2812
Comments
From the docs it seems that process.env it is not automatically injected. The way I've fixed this is by setting up a
However it seems that then all the data of process.ENV is saved and available to the client on Maybe is better to filter process.env and only allow safe variables coz I currently have DB connections info there. So maybe it would be better something like this:
Now you can access all your config with |
@microcipcip I mean if i can just easily inject in any component like this InjectComponent.vue export default {
inject: ["MEDIA_SERVER"],
mounted() {
console.log(this.MEDIA_SERVER)
}
} hmmm probably the best way if we can have an provide option in nuxt config like this provide: { then can be injected by any component which is helpful for the purpose of provide/inject api Provide/Inject(https://vuejs.org/v2/api/#provide-inject) |
@ralphchristianeclipse ooops sorry I didn't know about provide-inject property of Vue. |
@microcipcip its okay :) |
A decent |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
is this the right way to inject the env vars or is it automatically injected?
The text was updated successfully, but these errors were encountered: