Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

access .env variables in web-src?

ursboller
Community Advisor
Community Advisor

is it possible to access the data saved in the .env file within the app? eg. I have a screen and I want to access data saved in the .env file - basically to make a check. or do I really need to write an action for this?

1 Accepted Solution
SarahXu
Correct answer by
Level 3
Level 3

Hi @ursboller 

 

You would need to pass that info in through your action. You can pass in the value from .env into your action. Then have the action return these values to be consumed by your frontend code. 

 

Hope this helps,

Sarah

View solution in original post

5 Replies
SarahXu
Correct answer by
Level 3
Level 3

Hi @ursboller 

 

You would need to pass that info in through your action. You can pass in the value from .env into your action. Then have the action return these values to be consumed by your frontend code. 

 

Hope this helps,

Sarah

View solution in original post

ursboller
Community Advisor
Community Advisor

Hi @SarahXu that's what I assumed I need to do. My use case is having a router where one route (screen) is access restricted. means when calling the screen, I need to invoke an action which returns true or false for access. Is there any other way I can make a part of the app with access restriction? eg. by checking a "product profile id" or something similar?

SarahXu
Level 3
Level 3
you will have access to the ims profile of the user, which is available on client side, so you can potentially further limit user access that way!
ursboller
Community Advisor
Community Advisor
Hi @SarahXu just a short update: I now use the ims.profiles.roles to check if a user is in a desired user group (user group defined in app). If the role is missing, the component will display an access restriced message. additional test within actions will follow, need to check available data. but so far it works as expected.