diff --git a/infrastructure/deployment/sync-env-from-ssm.py b/infrastructure/deployment/sync-env-from-ssm.py index d4cc891..200f90b 100644 --- a/infrastructure/deployment/sync-env-from-ssm.py +++ b/infrastructure/deployment/sync-env-from-ssm.py @@ -29,7 +29,7 @@ STATIC_CONFIG = { "AAMOS_MODE": "gemini", "AAMOS_API_URL": "https://amos.aamos.systems", "AAMOS_TIMEOUT_MS": "60000", - "GEMINI_MODEL": "gemini-2.5-flash", + # GEMINI_MODEL hämtas från SSM (String-typ) "GEMINI_TIMEOUT_MS": "60000", "GEMINI_DAILY_BUDGET_USD": "25", "ENTITLEMENT_TTL_HOURS": "24", @@ -39,9 +39,12 @@ STATIC_CONFIG = { "S3_MODE": "aws", "S3_BUCKET": "cibello-production", "S3_REGION": "eu-north-1", + "SMTP_HOST": "mail.aamos.systems", "SMTP_PORT": "587", "SMTP_SECURE": "false", - "EMAIL_MODE": "log", + "SMTP_USER": "hello@cibello.app", + "MAIL_FROM": "hello@cibello.app", + "EMAIL_MODE": "smtp", "EXPO_PUSH_ENABLED": "false", "DATABASE_CA_CERT": "/opt/cibello-platform/certs/rds-global-bundle.pem", } @@ -53,6 +56,7 @@ SSM_MAP = { "entitlement-signing-secret": "ENTITLEMENT_SIGNING_SECRET", "eoc-push-token": "EOC_PUSH_TOKEN", "gemini-api-key": "GEMINI_API_KEY", + "gemini-model": "GEMINI_MODEL", "jwt-access-secret": "JWT_ACCESS_SECRET", "jwt-refresh-secret": "JWT_REFRESH_SECRET", "smtp-pass": "SMTP_PASS", @@ -65,18 +69,23 @@ SSM_MAP = { def get_parameters(names: list[str]) -> dict[str, str]: if not names: return {} - cmd = [ - "aws", "ssm", "get-parameters", - "--names", *names, - "--with-decryption", - "--region", REGION, - ] - result = subprocess.run(cmd, capture_output=True, text=True, check=True) - data = json.loads(result.stdout) - out = {} - for p in data.get("Parameters", []): - out[p["Name"]] = p["Value"] - for inv in data.get("InvalidParameters", []): + out: dict[str, str] = {} + invalid: list[str] = [] + # AWS GetParameters max 10 namn per anrop. + for i in range(0, len(names), 10): + batch = names[i : i + 10] + cmd = [ + "aws", "ssm", "get-parameters", + "--names", *batch, + "--with-decryption", + "--region", REGION, + ] + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + data = json.loads(result.stdout) + for p in data.get("Parameters", []): + out[p["Name"]] = p["Value"].strip() + invalid.extend(data.get("InvalidParameters", [])) + for inv in invalid: print(f"[sync-env] WARN: SSM-parameter saknas: {inv}", file=sys.stderr) return out diff --git a/packages/recipe-generation/scripts/scale-batch.ts b/packages/recipe-generation/scripts/scale-batch.ts index 50e6ae1..01e9025 100644 --- a/packages/recipe-generation/scripts/scale-batch.ts +++ b/packages/recipe-generation/scripts/scale-batch.ts @@ -9,7 +9,7 @@ * - Rapporterar yield, täckningsmatris, dedup-statistik, kostnad. * * Körning: - * GEMINI_API_KEY=$(aws ssm get-parameter --name "/openclaw/GEMINI_API_KEY" ...) \ + * GEMINI_API_KEY=$(aws ssm get-parameter --name "/cibello/prod/gemini-api-key" --with-decryption --query Parameter.Value --output text) \ * DATABASE_URL=... \ * pnpm tsx packages/recipe-generation/scripts/scale-batch.ts */