Expand my Community achievements bar.

SOLVED

access .env variables in web-src?

Avatar

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?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi @Urs_Boller 

 

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

Avatar

Correct answer by
Level 4

Hi @Urs_Boller 

 

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

Avatar

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?

Avatar

Level 4
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!

Avatar

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.