moose-lib 0.6.36__py3-none-any.whl → 0.6.37__py3-none-any.whl

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.

Potentially problematic release.


This version of moose-lib might be problematic. Click here for more details.

@@ -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}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moose_lib
3
- Version: 0.6.36
3
+ Version: 0.6.37
4
4
  Home-page: https://www.fiveonefour.com/moose
5
5
  Author: Fiveonefour Labs Inc.
6
6
  Author-email: support@fiveonefour.com
@@ -10,7 +10,7 @@ moose_lib/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
10
10
  moose_lib/clients/redis_client.py,sha256=UBCdxwgZpIOIOy2EnPyxJIAYjw_qmNwGsJQCQ66SxUI,8117
11
11
  moose_lib/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  moose_lib/config/config_file.py,sha256=NyjY6YFraBel7vBk18lLkpGaPR1viKMAEv4ZldyfLIA,2585
13
- moose_lib/config/runtime.py,sha256=gF1wrUCbp0MxRU92k0vyItvWX2x6P1FuBRzM61nJE_U,2776
13
+ moose_lib/config/runtime.py,sha256=h4SXRn4Mlbeh02lKN7HX2Mdp3QzySnZOeSvm8G-B3ko,3857
14
14
  moose_lib/dmv2/__init__.py,sha256=3DVAtNMZUoP94CMJBFhuXfYEQXDbQUNKSgg9XnKqae0,2768
15
15
  moose_lib/dmv2/_registry.py,sha256=RweMQWHSvhxgSceZ5mfd0NGnJ-49VZORbaFmw-O0bFY,611
16
16
  moose_lib/dmv2/consumption.py,sha256=KJV9MKgrnVLIRhlFVZMDhTsXvOaZoMiHk4hnRePdPWA,8745
@@ -33,7 +33,7 @@ tests/__init__.py,sha256=0Gh4yzPkkC3TzBGKhenpMIxJcRhyrrCfxLSfpTZnPMQ,53
33
33
  tests/conftest.py,sha256=ZVJNbnr4DwbcqkTmePW6U01zAzE6QD0kNAEZjPG1f4s,169
34
34
  tests/test_moose.py,sha256=mBsx_OYWmL8ppDzL_7Bd7xR6qf_i3-pCIO3wm2iQNaA,2136
35
35
  tests/test_redis_client.py,sha256=d9_MLYsJ4ecVil_jPB2gW3Q5aWnavxmmjZg2uYI3LVo,3256
36
- moose_lib-0.6.36.dist-info/METADATA,sha256=CFXyp28CAJG79cDrvFrIbZCgRioQ6wgmi3gqWsl6KSA,730
37
- moose_lib-0.6.36.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- moose_lib-0.6.36.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
39
- moose_lib-0.6.36.dist-info/RECORD,,
36
+ moose_lib-0.6.37.dist-info/METADATA,sha256=-OmXOzkMLfiQI20STY4teKKfyzojxF7Fqbq9rdmQL0E,730
37
+ moose_lib-0.6.37.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ moose_lib-0.6.37.dist-info/top_level.txt,sha256=XEns2-4aCmGp2XjJAeEH9TAUcGONLnSLy6ycT9FSJh8,16
39
+ moose_lib-0.6.37.dist-info/RECORD,,