Skip to content
Back

[SOLVED] How to access .env variables in functions 1.4.2?

  • 0
  • Functions
Osman
15 Sep, 2023, 07:16

In my function i want to access the _APP_ENV environment variable, but i think this changed in the new update. For my workflow it doesn't really work having to manually create this variable in the appwrite console, since im switching between production(on server) to development(local pc) appwrite environments.

TL;DR
[SOLVED] To access .env variables in functions 1.4.2, you can set the variable in the console and then don't overwrite the variables on deploy. Alternatively, you can use project level variables instead of function-level variables. There is documentation available for reference.
Osman
15 Sep, 2023, 08:39

For now i'm gonna update the variables manually using the CLI when importing production. But would be nice not having to do that.

Drake
15 Sep, 2023, 20:17

y'no there are project level variables now. maybe you can set the variables in your project instead of function?

Drake
15 Sep, 2023, 20:17

or you can set the variable in the console and then don't overwrite the variables on deploy

Osman
16 Sep, 2023, 16:42

Yeaa, i just thought you could access the appwrite variables in the local .env directly in the functions. But ill make use of the CLI, and think itll be fine.

Osman
16 Sep, 2023, 16:43

[CLOSED] How to access .env variables in functions 1.4.2?

Osman
16 Sep, 2023, 16:43

[SOLVED] How to access .env variables in functions 1.4.2?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more