You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the docs it seems that process.env it is not automatically injected. The way I've fixed this is by setting up a conf variable in nuxt.config.js:
{
env: {
conf: process.env
},
}
However it seems that then all the data of process.ENV is saved and available to the client on .nuxt/utils.js which could be a very very serious security issue.
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:
Activity
microcipcip commentedon Feb 11, 2018
From the docs it seems that process.env it is not automatically injected. The way I've fixed this is by setting up a
conf
variable in nuxt.config.js:However it seems that then all the data of process.ENV is saved and available to the client on
.nuxt/utils.js
which could be a very very serious security issue.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
process.env.conf.PORT
etc etc...ralphchristianeclipse commentedon Feb 13, 2018
@microcipcip I mean if i can just easily inject in any component like this
InjectComponent.vue
hmmm probably the best way if we can have an provide option in nuxt config like this
provide: {
MEDIA_SERVER: "ASFSAF"
}
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)
microcipcip commentedon Feb 13, 2018
@ralphchristianeclipse ooops sorry I didn't know about provide-inject property of Vue.
ralphchristianeclipse commentedon Feb 14, 2018
@microcipcip its okay :)
TheAlexLichter commentedon Aug 12, 2018
A decent
inject
documentation will be released soon (see nuxt/docs#694)lock commentedon Nov 1, 2018
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.