dbos 0.25.0a16__py3-none-any.whl → 0.26.0a1__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.
dbos/_dbos_config.py CHANGED
@@ -215,9 +215,13 @@ def translate_dbos_config_to_config_file(config: DBOSConfig) -> ConfigFile:
215
215
 
216
216
 
217
217
  def _substitute_env_vars(content: str, silent: bool = False) -> str:
218
- regex = r"\$\{([^}]+)\}" # Regex to match ${VAR_NAME} style placeholders
219
218
 
220
- def replace_func(match: re.Match[str]) -> str:
219
+ # Regex to match ${DOCKER_SECRET:SECRET_NAME} style placeholders for Docker secrets
220
+ secret_regex = r"\$\{DOCKER_SECRET:([^}]+)\}"
221
+ # Regex to match ${VAR_NAME} style placeholders for environment variables
222
+ env_regex = r"\$\{(?!DOCKER_SECRET:)([^}]+)\}"
223
+
224
+ def replace_env_func(match: re.Match[str]) -> str:
221
225
  var_name = match.group(1)
222
226
  value = os.environ.get(
223
227
  var_name, ""
@@ -228,7 +232,30 @@ def _substitute_env_vars(content: str, silent: bool = False) -> str:
228
232
  )
229
233
  return value
230
234
 
231
- return re.sub(regex, replace_func, content)
235
+ def replace_secret_func(match: re.Match[str]) -> str:
236
+ secret_name = match.group(1)
237
+ try:
238
+ # Docker secrets are stored in /run/secrets/
239
+ secret_path = f"/run/secrets/{secret_name}"
240
+ if os.path.exists(secret_path):
241
+ with open(secret_path, "r") as f:
242
+ return f.read().strip()
243
+ elif not silent:
244
+ dbos_logger.warning(
245
+ f"Docker secret {secret_name} would be substituted from /run/secrets/{secret_name}, but the file does not exist"
246
+ )
247
+ return ""
248
+ except Exception as e:
249
+ if not silent:
250
+ dbos_logger.warning(
251
+ f"Error reading Docker secret {secret_name}: {str(e)}"
252
+ )
253
+ return ""
254
+
255
+ # First replace Docker secrets
256
+ content = re.sub(secret_regex, replace_secret_func, content)
257
+ # Then replace environment variables
258
+ return re.sub(env_regex, replace_env_func, content)
232
259
 
233
260
 
234
261
  def get_dbos_database_url(config_file_path: str = DBOS_CONFIG_PATH) -> str:
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "password": {
42
42
  "type": ["string", "null"],
43
- "description": "The password to use when connecting to the application database. Developers are strongly encouraged to use environment variable substitution to avoid storing secrets in source."
43
+ "description": "The password to use when connecting to the application database. Developers are strongly encouraged to use environment variable substitution (${VAR_NAME}) or Docker secrets (${DOCKER_SECRET:SECRET_NAME}) to avoid storing secrets in source."
44
44
  },
45
45
  "connectionTimeoutMillis": {
46
46
  "type": "number",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 0.25.0a16
3
+ Version: 0.26.0a1
4
4
  Summary: Ultra-lightweight durable execution in Python
5
5
  Author-Email: "DBOS, Inc." <contact@dbos.dev>
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
- dbos-0.25.0a16.dist-info/METADATA,sha256=D0y5Vi7WtgVlpaBzrj3JhirxVna3o-zhQQiOu_Kb1Mc,5554
2
- dbos-0.25.0a16.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- dbos-0.25.0a16.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
- dbos-0.25.0a16.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
1
+ dbos-0.26.0a1.dist-info/METADATA,sha256=ziHAfEpwbBK6AKLbucZsDQNvMbYjgdfP8b9dp-NJE-8,5553
2
+ dbos-0.26.0a1.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ dbos-0.26.0a1.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
+ dbos-0.26.0a1.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
5
5
  dbos/__init__.py,sha256=3NQfGlBiiUSM_v88STdVP3rNZvGkUL_9WbSotKb8Voo,873
6
6
  dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
7
7
  dbos/_admin_server.py,sha256=FLUacm9WGIPjB5s3QhdpMCilc8JHJOF0KMNStF82qs0,6625
@@ -18,7 +18,7 @@ dbos/_core.py,sha256=kIj_4wlIff8ptlACJKXAPSNoyJIt2h44swjMKxfwv0k,45789
18
18
  dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
19
19
  dbos/_db_wizard.py,sha256=VnMa6OL87Lc-XPDD1RnXp8NjsJE8YgiQLj3wtWAXp-8,8252
20
20
  dbos/_dbos.py,sha256=AKfB61vvz5shPoEpKxqrqoiDemintKMqyBxhESRRJE8,45231
21
- dbos/_dbos_config.py,sha256=7Qm3FARP3lTKZS0gSxDHLbpaDCT30GzfyERxfCde4bc,21566
21
+ dbos/_dbos_config.py,sha256=rTn30Hgh-RzTxqHbnYh2pC3Ioo30eJV9K4YxhJd-Gj4,22718
22
22
  dbos/_debug.py,sha256=mmgvLkqlrljMBBow9wk01PPur9kUf2rI_11dTJXY4gw,1822
23
23
  dbos/_error.py,sha256=B6Y9XLS1f6yrawxB2uAEYFMxFwk9BHhdxPNddKco-Fw,5399
24
24
  dbos/_fastapi.py,sha256=PhaKftbApHnjtYEOw0EYna_3K0cmz__J9of7mRJWzu4,3704
@@ -64,7 +64,7 @@ dbos/_workflow_commands.py,sha256=SYp2khc9RSf6tjllG9CqT1zjBQnFTFq33ePXpvmRwME,58
64
64
  dbos/cli/_github_init.py,sha256=Y_bDF9gfO2jB1id4FV5h1oIxEJRWyqVjhb7bNEa5nQ0,3224
65
65
  dbos/cli/_template_init.py,sha256=-WW3kbq0W_Tq4WbMqb1UGJG3xvJb3woEY5VspG95Srk,2857
66
66
  dbos/cli/cli.py,sha256=G55sZJxfmvUGvWr0hoIWwVZBy-fJdpCsTsZmuHT1CjA,16049
67
- dbos/dbos-config.schema.json,sha256=HtF_njVTGHLdzBGZ4OrGQz3qbPPT0Go-iwd1PgFVTNg,5847
67
+ dbos/dbos-config.schema.json,sha256=4z2OXPfp7H0uNT1m5dKxjg31qbAfPyKkFXwHufuUMec,5910
68
68
  dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
69
69
  version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
70
- dbos-0.25.0a16.dist-info/RECORD,,
70
+ dbos-0.26.0a1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: pdm-backend (2.4.3)
2
+ Generator: pdm-backend (2.4.4)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any