Back

How to include .env

  • 0
  • Self Hosted
  • Functions
A
12 Nov, 2024, 13:24

Hello! I am trying to include an env. variable, but the execution fails. Do you have any idea what is wrong?

TypeScript
        async def process_file(file):
            try:
                allowed_extensions = os.getenv("ALLOWED_EXTENSIONS", "").split(",")
                if not allowed_extensions:
                    raise ValueError("ALLOWED_EXTENSIONS not set")

                if file["type"] == "file" and file["name"].lower().endswith(
                    (tuple(allowed_extensions))
                ):
TL;DR
Developers are trying to include an environment variable in their code, however, the execution fails. The problem might be the environment variable not being set. Make sure to set it properly.
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