@opengeni/config 0.7.7 → 0.7.10
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.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +29 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/config",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.10",
|
|
4
4
|
"description": "OpenGeni runtime configuration: settings resolution, deployment knobs, and config validation shared across the server packages.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@opengeni/codex": "^0.2.7",
|
|
37
|
-
"@opengeni/contracts": "^0.
|
|
37
|
+
"@opengeni/contracts": "^0.21.0",
|
|
38
38
|
"zod": "^4.2.1"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
package/src/index.ts
CHANGED
|
@@ -265,6 +265,8 @@ const SettingsSchema = z.object({
|
|
|
265
265
|
integrationsStateSecret: z.string().optional(),
|
|
266
266
|
integrationsAllowPrivateNetworkTargets: EnvBoolean.default(false),
|
|
267
267
|
integrationsOauthClientsJson: z.string().default("{}"),
|
|
268
|
+
slackClientId: z.string().optional(),
|
|
269
|
+
slackClientSecret: z.string().optional(),
|
|
268
270
|
// Undefined is meaningful: the migration boundary persists the product
|
|
269
271
|
// default of 3 when no deployment override is supplied.
|
|
270
272
|
maxNestedAgentDepth: z.coerce.number().int().nonnegative().max(MAX_NESTED_AGENT_DEPTH).optional(),
|
|
@@ -1369,6 +1371,8 @@ export function getSettings(): Settings {
|
|
|
1369
1371
|
"OPENGENI_INTEGRATIONS_ALLOW_PRIVATE_NETWORK_TARGETS",
|
|
1370
1372
|
),
|
|
1371
1373
|
integrationsOauthClientsJson: optional("OPENGENI_INTEGRATIONS_OAUTH_CLIENTS_JSON"),
|
|
1374
|
+
slackClientId: optional("OPENGENI_SLACK_CLIENT_ID"),
|
|
1375
|
+
slackClientSecret: optional("OPENGENI_SLACK_CLIENT_SECRET"),
|
|
1372
1376
|
maxNestedAgentDepth: optional("OPENGENI_MAX_NESTED_AGENT_DEPTH"),
|
|
1373
1377
|
goalMaxAutoContinuations: optional("OPENGENI_GOAL_MAX_AUTO_CONTINUATIONS"),
|
|
1374
1378
|
goalNoProgressLimit: optional("OPENGENI_GOAL_NO_PROGRESS_LIMIT"),
|
|
@@ -3381,6 +3385,31 @@ function validateSettings(settings: Settings): void {
|
|
|
3381
3385
|
);
|
|
3382
3386
|
}
|
|
3383
3387
|
}
|
|
3388
|
+
if (Boolean(settings.slackClientId) !== Boolean(settings.slackClientSecret)) {
|
|
3389
|
+
throw new Error(
|
|
3390
|
+
"OPENGENI_SLACK_CLIENT_ID and OPENGENI_SLACK_CLIENT_SECRET must be configured together",
|
|
3391
|
+
);
|
|
3392
|
+
}
|
|
3393
|
+
if (settings.slackClientId) {
|
|
3394
|
+
if (!settings.publicBaseUrl) {
|
|
3395
|
+
throw new Error(
|
|
3396
|
+
"OPENGENI_PUBLIC_BASE_URL is required when the OpenGeni Slack app is configured",
|
|
3397
|
+
);
|
|
3398
|
+
}
|
|
3399
|
+
if (
|
|
3400
|
+
!settings.publicBaseUrl.startsWith("https://") &&
|
|
3401
|
+
!["local", "test"].includes(settings.environment)
|
|
3402
|
+
) {
|
|
3403
|
+
throw new Error(
|
|
3404
|
+
"OPENGENI_PUBLIC_BASE_URL must use https when the OpenGeni Slack app is configured outside local/test",
|
|
3405
|
+
);
|
|
3406
|
+
}
|
|
3407
|
+
if (!settings.integrationsStateSecret) {
|
|
3408
|
+
throw new Error(
|
|
3409
|
+
"OPENGENI_INTEGRATIONS_STATE_SECRET is required when the OpenGeni Slack app is configured",
|
|
3410
|
+
);
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3384
3413
|
parseIntegrationsOauthClientsJson(settings.integrationsOauthClientsJson);
|
|
3385
3414
|
if (
|
|
3386
3415
|
settings.productAccessMode === "configured" &&
|