Configuring environment variables for the Zyeta backend
.env
file by copying the provided .env.local
template:
.env
file contains sensitive information and should never be committed to version control. Note that it’s already included in the .gitignore
file.postgresql+asyncpg://user:password@host:port/database
Examples:
postgresql+asyncpg://postgres:mysecretpassword@localhost:5432/postgres
postgresql+asyncpg://postgres:password@db.izufeytmzeanvqoyckwp.supabase.co:5432/postgres
alembic.copy.ini
template that you should copy to create your own alembic.ini
:
sqlalchemy.url
field in alembic.ini
to match your database connection string. Note that you need to escape percent signs (%
) with another percent sign (%%
):
dotenv
package to load environment variables from the .env
file. The settings are loaded using Pydantic’s BaseSettings
class, which provides type validation and default values.
settings
object to access environment variables:
.env
filesEnvironment Variables Not Loading
.env
file is in the root directory of the project. Check that the file format is correct (no spaces around equals signs).Type Validation Errors
.env
file match the expected types in the Settings class. For example, JWT_EXPIRE_MINUTES
should be an integer.Missing Required Variables
.env
file against the required variables list.Database Connection String Issues
alembic.ini
, remember to escape percent signs with another percent sign: