Reputation: 5418
Can a user who is using my vuejs app, see the values of .env variables or are they somehow hidden?
I want to keep an app-id that is part of a websocket URL private. It is probably not a problem for users to see it, but I would rather they didn't
I could connect to the WS service via node on a backend server and pipe the data to the end user, but since I am working with real-time trading data, that would double the latency to the end user.
Upvotes: 1
Views: 489
Reputation: 1300
In short words: No.
If you need to pass data to the client you cannot hide, you could try to hide or mask, but if the code is in the client, the code is available.
Moreover, if you use it on a websocket it will be very easy to get with de Chrome Dev Tools (or any web browser dev tools):
The idea that you propose to the back-end seems to be best to hide your app-id, to reduce the latency make your middleware in the middle of the clients and the other server, I mean, if you need the data from Canada and most of the users are in México i will try to put the middleware on Canadá, EEUU or México.
In general, I will avoid the middleware proposal excepts these cases:
Hope it helps :) If you need more, please share more info about the project.
Upvotes: 2