moose-lib 0.6.36__tar.gz → 0.6.37__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {moose_lib-0.6.36 → moose_lib-0.6.37}/PKG-INFO +1 -1
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/config/runtime.py +33 -6
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib.egg-info/PKG-INFO +1 -1
- {moose_lib-0.6.36 → moose_lib-0.6.37}/README.md +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/__init__.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/blocks.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/clients/__init__.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/clients/redis_client.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/commons.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/config/__init__.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/config/config_file.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/data_models.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/__init__.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/_registry.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/consumption.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/ingest_api.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/ingest_pipeline.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/life_cycle.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/materialized_view.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/olap_table.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/registry.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/sql_resource.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/stream.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/types.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/view.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2/workflow.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/dmv2-serializer.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/internal.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/main.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/query_param.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/streaming/__init__.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/streaming/streaming_function_runner.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/utilities/__init__.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib/utilities/sql.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib.egg-info/SOURCES.txt +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib.egg-info/dependency_links.txt +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib.egg-info/requires.txt +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/moose_lib.egg-info/top_level.txt +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/setup.cfg +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/setup.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/tests/__init__.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/tests/conftest.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/tests/test_moose.py +0 -0
- {moose_lib-0.6.36 → moose_lib-0.6.37}/tests/test_redis_client.py +0 -0
|
@@ -4,6 +4,7 @@ Runtime configuration management for Moose.
|
|
|
4
4
|
This module provides a singleton registry for managing runtime configuration settings,
|
|
5
5
|
particularly for ClickHouse connections.
|
|
6
6
|
"""
|
|
7
|
+
import os
|
|
7
8
|
from dataclasses import dataclass
|
|
8
9
|
from typing import Optional
|
|
9
10
|
|
|
@@ -58,15 +59,41 @@ class ConfigurationRegistry:
|
|
|
58
59
|
|
|
59
60
|
# Fallback to reading from config file
|
|
60
61
|
from .config_file import read_project_config
|
|
62
|
+
|
|
63
|
+
def _env(name: str) -> Optional[str]:
|
|
64
|
+
val = os.environ.get(name)
|
|
65
|
+
if val is None:
|
|
66
|
+
return None
|
|
67
|
+
trimmed = val.strip()
|
|
68
|
+
return trimmed if trimmed else None
|
|
69
|
+
|
|
70
|
+
def _parse_bool(val: Optional[str]) -> Optional[bool]:
|
|
71
|
+
if val is None:
|
|
72
|
+
return None
|
|
73
|
+
v = val.strip().lower()
|
|
74
|
+
if v in ("1", "true", "yes", "on"):
|
|
75
|
+
return True
|
|
76
|
+
if v in ("0", "false", "no", "off"):
|
|
77
|
+
return False
|
|
78
|
+
return None
|
|
79
|
+
|
|
61
80
|
try:
|
|
62
81
|
config = read_project_config()
|
|
82
|
+
|
|
83
|
+
env_host = _env("MOOSE_CLICKHOUSE_CONFIG__HOST")
|
|
84
|
+
env_port = _env("MOOSE_CLICKHOUSE_CONFIG__HOST_PORT")
|
|
85
|
+
env_user = _env("MOOSE_CLICKHOUSE_CONFIG__USER")
|
|
86
|
+
env_password = _env("MOOSE_CLICKHOUSE_CONFIG__PASSWORD")
|
|
87
|
+
env_db = _env("MOOSE_CLICKHOUSE_CONFIG__DB_NAME")
|
|
88
|
+
env_use_ssl = _parse_bool(_env("MOOSE_CLICKHOUSE_CONFIG__USE_SSL"))
|
|
89
|
+
|
|
63
90
|
return RuntimeClickHouseConfig(
|
|
64
|
-
host=config.clickhouse_config.host,
|
|
65
|
-
port=str(config.clickhouse_config.host_port),
|
|
66
|
-
username=config.clickhouse_config.user,
|
|
67
|
-
password=config.clickhouse_config.password,
|
|
68
|
-
database=config.clickhouse_config.db_name,
|
|
69
|
-
use_ssl=config.clickhouse_config.use_ssl
|
|
91
|
+
host=env_host or config.clickhouse_config.host,
|
|
92
|
+
port=(env_port or str(config.clickhouse_config.host_port)),
|
|
93
|
+
username=env_user or config.clickhouse_config.user,
|
|
94
|
+
password=env_password or config.clickhouse_config.password,
|
|
95
|
+
database=env_db or config.clickhouse_config.db_name,
|
|
96
|
+
use_ssl=(env_use_ssl if env_use_ssl is not None else config.clickhouse_config.use_ssl),
|
|
70
97
|
)
|
|
71
98
|
except Exception as e:
|
|
72
99
|
raise RuntimeError(f"Failed to get ClickHouse configuration: {e}")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|