major checkpoint
This commit is contained in:
+7
-2
@@ -3,13 +3,11 @@ import os
|
||||
from config.base import BaseConfig
|
||||
from config.development import DevelopmentConfig
|
||||
from config.testing import TestingConfig
|
||||
from config.production import ProductionConfig
|
||||
|
||||
|
||||
config_by_name = {
|
||||
"development": DevelopmentConfig,
|
||||
"testing": TestingConfig,
|
||||
"production": ProductionConfig,
|
||||
"default": DevelopmentConfig,
|
||||
}
|
||||
|
||||
@@ -18,4 +16,11 @@ def get_config(config_name=None):
|
||||
"""Get configuration object based on environment."""
|
||||
if config_name is None:
|
||||
config_name = os.getenv("FLASK_ENV", "development")
|
||||
|
||||
# Lazy import of ProductionConfig to avoid requiring SECRET_KEY in non-production environments
|
||||
if config_name == "production":
|
||||
from config.production import ProductionConfig
|
||||
config_by_name["production"] = ProductionConfig
|
||||
return ProductionConfig
|
||||
|
||||
return config_by_name.get(config_name, DevelopmentConfig)
|
||||
|
||||
Reference in New Issue
Block a user