diff --git a/.env.example b/.env.example index 0c43f31..5e42099 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,11 @@ APP_ENV=development APP_PREFIX= DATABASE_URL=sqlite:///./app.db +SECRET_KEY=changeme-replace-in-production -# Produktion (MariaDB): +# Produktion (MariaDB + LDAP): # APP_ENV=production # APP_PREFIX=/uph -# DATABASE_URL=mysql+pymysql://user:password@db:3306/efihub \ No newline at end of file +# DATABASE_URL=mysql+pymysql://user:password@db:3306/efihub +# SECRET_KEY= +# LDAP_ENABLED=true \ No newline at end of file diff --git a/app/core/config.py b/app/core/config.py index 96600f5..f1bde1f 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -9,6 +9,11 @@ class Settings(BaseSettings): APP_ENV: str = "development" APP_PREFIX: str = "" DATABASE_URL: str = "sqlite:///./app.db" + SECRET_KEY: str = "changeme-replace-in-production" + LDAP_ENABLED: bool = False + LDAP_SERVER: str = "gso1.ads1.fh-nuernberg.de" + LDAP_DOMAIN: str = "ADS1" + LDAP_SEARCH_BASE: str = "OU=users,OU=EFI,OU=Faculties,DC=ADS1,DC=fh-nuernberg,DC=de" @lru_cache diff --git a/requirements.txt b/requirements.txt index 2d2a0f3..7c75099 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,9 @@ pydantic-settings sqlalchemy jinja2 pytest -httpx \ No newline at end of file +httpx +alembic +python-jose[cryptography] +passlib[bcrypt] +python-multipart +ldap3 \ No newline at end of file diff --git a/tests/test_config.py b/tests/test_config.py new file mode 100644 index 0000000..134c096 --- /dev/null +++ b/tests/test_config.py @@ -0,0 +1,10 @@ +from app.core.config import get_settings + + +def test_new_config_fields_have_defaults(): + s = get_settings() + assert hasattr(s, "SECRET_KEY") + assert hasattr(s, "LDAP_ENABLED") + assert s.LDAP_ENABLED is False + assert s.LDAP_SERVER == "gso1.ads1.fh-nuernberg.de" + assert s.LDAP_DOMAIN == "ADS1"