added is_production and overrides
This commit is contained in:
1 parent
1ae0636201
commit
79d3fb72f9
4 files changed
+52
-40
No files matched your search
@@ -11,8 +11,9 @@ from monitor_utils.constants import (
|
||||
EXPECTED_TASK_ERRORS,
|
||||
FLAG_WEBHOOK_MAP,
|
||||
BUCKET_WEBHOOK_MAP,
|
||||
LOGGING_LEVEL,
|
||||
)
|
||||
from monitor_utils.config import get_settings, get_config
|
||||
from monitor_utils.config import get_config, is_production
|
||||
from monitor_utils.models import (
|
||||
Product,
|
||||
ProductMetadata,
|
||||
@@ -28,21 +29,23 @@ LOGGER = logging.getLogger(__name__)
|
||||
|
||||
def configure_logging():
|
||||
logging.basicConfig(
|
||||
level=get_settings().logging_level,
|
||||
level=LOGGING_LEVEL,
|
||||
format="%(asctime)s - %(levelname)s - %(module)s - %(funcName)s - %(message)s",
|
||||
)
|
||||
|
||||
|
||||
def setup_config(monitor_name: str) -> tuple[list[str], dict, AsyncIOMotorCollection]:
|
||||
is_production = get_settings().development_mode == "PRODUCTION"
|
||||
def setup_config(
|
||||
monitor_name: str, override_production=False
|
||||
) -> tuple[list[str], dict, AsyncIOMotorCollection]:
|
||||
use_production = is_production(override_production)
|
||||
config, _ = get_config(
|
||||
monitor_name=monitor_name,
|
||||
use_production_path=is_production,
|
||||
use_production_path=use_production,
|
||||
)
|
||||
|
||||
category_names = config["categories"]
|
||||
collection = get_collection(
|
||||
monitor_name if is_production else f"{monitor_name}_testing"
|
||||
monitor_name if use_production else f"{monitor_name}_testing"
|
||||
)
|
||||
return category_names, config["channels"], collection
|
||||
|
||||
|
||||
Reference in new issue
Block a user