24 lines
754 B
Python
24 lines
754 B
Python
"""
|
|
Configuration for the Student Management System.
|
|
|
|
Connection settings are read from environment variables first, falling back
|
|
to the defaults below (which match the assignment's requirements). This
|
|
means you can run the app as-is, or override any value like:
|
|
|
|
DB_HOST=10.10.0.160 DB_USER=root DB_PASSWORD=secret python3 main.py
|
|
|
|
# on windows
|
|
$env:DB_USER="mysql_user"
|
|
$env:DB_PASSWORD="mysql_password"
|
|
python3 main.py
|
|
"""
|
|
|
|
import os
|
|
|
|
DB_HOST = os.environ.get("DB_HOST", "10.10.0.160")
|
|
DB_PORT = int(os.environ.get("DB_PORT", "3306"))
|
|
DB_USER = os.environ.get("DB_USER", "root")
|
|
DB_PASSWORD = os.environ.get("DB_PASSWORD", "")
|
|
DB_NAME = os.environ.get("DB_NAME", "student_db")
|
|
DB_CONNECT_TIMEOUT = int(os.environ.get("DB_CONNECT_TIMEOUT", "10"))
|