Add .env-example file and update configuration for environment variables

- Created .env-example for environment variable setup
- Updated README to reflect changes in .env file creation
- Modified config.py to include new environment variables and DATABASE_URL property
- Enhanced database.py with connect and disconnect functions
- Updated main.py to manage database connection lifecycle
- Adjusted compose.yaml for consistent environment variable usage
This commit is contained in:
2026-02-24 13:38:54 +01:00
parent a5c93d1f8a
commit 17d3b1caac
6 changed files with 60 additions and 28 deletions

View File

@ -35,14 +35,14 @@ project/
### Setup
Create a .env file in the root directory:
Create a .env file, by copying .env-example, in the root directory and adjustign the vaulues as needed:
```text
postgres_user=exampleUser
postgres_password=examplePasswd
postgres_db=exampleDB
db_port=5432
api_port=8000
POSTGRES_USER=exampleUser
POSTGRES_PASSWORD=examplePasswd
POSTGRES_DB=exampleDB
API_PORT=8000
DEBUG=true
```
Start the stack:
@ -71,4 +71,4 @@ Do not run in production.
The database schema is managed via Create.sql — no ORM migrations
The .env file is excluded from version control via .gitignore
```
```