infrasynth-backend-kit/infrasynth/shared/settings_utils.py
2026-08-28 14:38:47 -05:00

13 lines
399 B
Python

from django.conf import settings
def get_setting(prefix: str, key: str, default=None):
"""
Reads a setting with a given app prefix dict.
Example:
get_setting("INFRASYNTH_SECURITY", "COOKIE_SECURE", True)
Looks up settings.INFRASYNTH_SECURITY["COOKIE_SECURE"] with fallback to default.
"""
config = getattr(settings, prefix, {})
return config.get(key, default)