Back

How to add env variables to functions in Appwrite.json?

  • 0
  • Self Hosted
  • Functions
Ponguta_
16 Feb, 2023, 14:28

Hello, how can I add env variables to the functions that I'm going to deploy in Appwrite.json?

TL;DR
Hello, in order to add environment variables to your functions in Appwrite.json, you can use the `variables` parameter. This parameter takes a JSON object of key-value pairs representing the variables. For more information, you can refer to the function options documentation here: https://appwrite.io/docs/command-line-deployment#function-options. Re-opening the thread showed that deploying twice may be necessary for the function to take the environment variables.
VincentGe
16 Feb, 2023, 14:53

Under the function

VincentGe
16 Feb, 2023, 14:53

The param variables

VincentGe
16 Feb, 2023, 14:53

takes a json object of key-value pairs for variables 😉

Ponguta_
16 Feb, 2023, 15:09

You save me a lot of time @VincentGe Thank you so much!

Ponguta_
16 Feb, 2023, 15:09

[SOLVED] How to add env variables to functions in Appwrite.json?

Ponguta_
16 Feb, 2023, 15:52

Btw, I have to deploy twice in order to my function takes the env variables.

Just in case for someone is useful info.

joeyouss
16 Feb, 2023, 16:58

Re-opening this!

joeyouss
16 Feb, 2023, 16:59

How to add env variables to functions in Appwrite.json?

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