feat: add worker config reader with secret decryption

This commit is contained in:
Jonathan
2026-07-10 20:07:49 +02:00
parent c90e055343
commit feaff42010
3 changed files with 51 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import psycopg
from lyra_worker.crypto import decrypt_secret
def get_config(conn: psycopg.Connection) -> dict[str, str]:
"""Return all config as {key: value}, decrypting rows marked secret."""
with conn.cursor() as cur:
cur.execute('SELECT key, value, secret FROM "Config"')
rows = cur.fetchall()
out: dict[str, str] = {}
for key, value, secret in rows:
out[key] = decrypt_secret(value) if secret else value
return out