@selvajs/cli 4.20.1-beta.0 → 4.20.1-beta.1
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/package.json +1 -1
- package/src/checks/config.js +1 -1
- package/src/env-migration.js +1 -1
- package/src/generated/config.js +247 -176
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selvajs/cli",
|
|
3
|
-
"version": "4.20.1-beta.
|
|
3
|
+
"version": "4.20.1-beta.1",
|
|
4
4
|
"description": "Scaffold and operate a Selva white-label deployment. `npx @selvajs/cli <dir>` to bootstrap, `selva <cmd>` to manage.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "VektorNode",
|
package/src/checks/config.js
CHANGED
|
@@ -365,7 +365,7 @@ export function checkKeyRotation(env, now = Date.now()) {
|
|
|
365
365
|
if (state === 'expired') {
|
|
366
366
|
return [
|
|
367
367
|
yellow(
|
|
368
|
-
`${previous}
|
|
368
|
+
`${previous} is no longer accepted: its deadline (${expires}) has passed, is not an ISO date or is too far out. ` +
|
|
369
369
|
`Remove it: npx selva keys rotate ${target} --finish`
|
|
370
370
|
)
|
|
371
371
|
];
|
package/src/env-migration.js
CHANGED
|
@@ -48,7 +48,7 @@ function canonical(value) {
|
|
|
48
48
|
function meaning(spec, env, { legacy }) {
|
|
49
49
|
if (EFFECTIVE[spec.key]) return EFFECTIVE[spec.key](env);
|
|
50
50
|
const name = [spec.key, ...(spec.aliases ?? [])].find(
|
|
51
|
-
(k) => env[k] !== undefined && env[k] !== ''
|
|
51
|
+
(k) => env[k] !== undefined && env[k].trim() !== ''
|
|
52
52
|
);
|
|
53
53
|
if (name === undefined) return spec.default;
|
|
54
54
|
const raw = env[name];
|
package/src/generated/config.js
CHANGED
|
@@ -24,6 +24,35 @@ function trimTrailing(s, ch) {
|
|
|
24
24
|
while (end > 0 && s[end - 1] === ch) end--;
|
|
25
25
|
return s.slice(0, end);
|
|
26
26
|
}
|
|
27
|
+
// ../platform/src/computeServer/key32.ts
|
|
28
|
+
/**
|
|
29
|
+
* A 32-byte key written as 64 hex characters or base64 (padding optional), or
|
|
30
|
+
* null. No `node:crypto` here: the config boot check imports this too.
|
|
31
|
+
*/
|
|
32
|
+
function parseKey32(raw) {
|
|
33
|
+
const key = raw.trim();
|
|
34
|
+
if (/^[0-9a-fA-F]{64}$/.test(key)) return Buffer.from(key, 'hex');
|
|
35
|
+
const buf = Buffer.from(key, 'base64');
|
|
36
|
+
return buf.length === 32 && trimTrailing(buf.toString('base64'), '=') === trimTrailing(key, '=')
|
|
37
|
+
? buf
|
|
38
|
+
: null;
|
|
39
|
+
}
|
|
40
|
+
// ../platform/src/config/raw-value.ts
|
|
41
|
+
/**
|
|
42
|
+
* The text a setting reads and the name it came from: its own key, else the
|
|
43
|
+
* first alias that is set. Blank counts as unset, so a `KEY=` line with stray
|
|
44
|
+
* spaces can't hide an alias or pass a required key as an empty string.
|
|
45
|
+
*/
|
|
46
|
+
function rawValue(spec, env) {
|
|
47
|
+
for (const name of [spec.key, ...(spec.aliases ?? [])]) {
|
|
48
|
+
const raw = env[name];
|
|
49
|
+
if (raw !== void 0 && raw.trim() !== '')
|
|
50
|
+
return {
|
|
51
|
+
name,
|
|
52
|
+
raw
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
27
56
|
// ../platform/src/config/resolve.ts
|
|
28
57
|
var TRUE = /* @__PURE__ */ new Set(['true', '1', 'yes', 'on']);
|
|
29
58
|
var FALSE = /* @__PURE__ */ new Set(['false', '0', 'no', 'off']);
|
|
@@ -41,7 +70,7 @@ function parse(spec, raw) {
|
|
|
41
70
|
value: v
|
|
42
71
|
};
|
|
43
72
|
case 'key':
|
|
44
|
-
return
|
|
73
|
+
return parseKey32(v)
|
|
45
74
|
? {
|
|
46
75
|
ok: true,
|
|
47
76
|
value: v
|
|
@@ -50,26 +79,45 @@ function parse(spec, raw) {
|
|
|
50
79
|
ok: false,
|
|
51
80
|
problem: 'must be 32 bytes as 64 hex characters or base64'
|
|
52
81
|
};
|
|
53
|
-
case 'url':
|
|
82
|
+
case 'url': {
|
|
83
|
+
const value = trimTrailing(v, '/');
|
|
84
|
+
let url;
|
|
54
85
|
try {
|
|
55
|
-
new URL(
|
|
56
|
-
return {
|
|
57
|
-
ok: true,
|
|
58
|
-
value: trimTrailing(v, '/')
|
|
59
|
-
};
|
|
86
|
+
url = new URL(value);
|
|
60
87
|
} catch {
|
|
61
88
|
return {
|
|
62
89
|
ok: false,
|
|
63
90
|
problem: 'must be an absolute URL'
|
|
64
91
|
};
|
|
65
92
|
}
|
|
93
|
+
if (url.protocol !== 'http:' && url.protocol !== 'https:')
|
|
94
|
+
return {
|
|
95
|
+
ok: false,
|
|
96
|
+
problem: 'must start with http:// or https://'
|
|
97
|
+
};
|
|
98
|
+
if (spec.origin && (url.username || url.password || url.pathname !== '/' || /[?#]/.test(v)))
|
|
99
|
+
return {
|
|
100
|
+
ok: false,
|
|
101
|
+
problem:
|
|
102
|
+
'must be an origin such as https://selva.example.com: no path, query or credentials'
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
ok: true,
|
|
106
|
+
value
|
|
107
|
+
};
|
|
108
|
+
}
|
|
66
109
|
case 'int': {
|
|
67
|
-
|
|
68
|
-
if (!Number.isInteger(n))
|
|
110
|
+
if (!/^[+-]?\d+$/.test(v))
|
|
69
111
|
return {
|
|
70
112
|
ok: false,
|
|
71
113
|
problem: 'must be a whole number'
|
|
72
114
|
};
|
|
115
|
+
const n = Number(v);
|
|
116
|
+
if (!Number.isSafeInteger(n))
|
|
117
|
+
return {
|
|
118
|
+
ok: false,
|
|
119
|
+
problem: 'is too large'
|
|
120
|
+
};
|
|
73
121
|
if (spec.min !== void 0 && n < spec.min)
|
|
74
122
|
return {
|
|
75
123
|
ok: false,
|
|
@@ -82,7 +130,7 @@ function parse(spec, raw) {
|
|
|
82
130
|
};
|
|
83
131
|
return {
|
|
84
132
|
ok: true,
|
|
85
|
-
value: n
|
|
133
|
+
value: n === 0 ? 0 : n
|
|
86
134
|
};
|
|
87
135
|
}
|
|
88
136
|
case 'bool': {
|
|
@@ -125,11 +173,6 @@ function parse(spec, raw) {
|
|
|
125
173
|
};
|
|
126
174
|
}
|
|
127
175
|
}
|
|
128
|
-
function isKey32(v) {
|
|
129
|
-
if (/^[0-9a-fA-F]{64}$/.test(v)) return true;
|
|
130
|
-
const buf = Buffer.from(v, 'base64');
|
|
131
|
-
return buf.length === 32 && trimTrailing(buf.toString('base64'), '=') === trimTrailing(v, '=');
|
|
132
|
-
}
|
|
133
176
|
/** What `raw` meant to the reader before it parsed strictly. */
|
|
134
177
|
function legacyValue(spec, raw) {
|
|
135
178
|
const legacy = spec.legacy;
|
|
@@ -141,54 +184,51 @@ function legacyValue(spec, raw) {
|
|
|
141
184
|
return parsed.ok ? parsed.value : void 0;
|
|
142
185
|
}
|
|
143
186
|
function resolveKey(spec, env) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const base = {
|
|
153
|
-
key: spec.key,
|
|
154
|
-
spec,
|
|
155
|
-
...(alias ? { alias } : {})
|
|
156
|
-
};
|
|
157
|
-
if (raw === void 0) {
|
|
187
|
+
const found = rawValue(spec, env);
|
|
188
|
+
if (!found) {
|
|
189
|
+
const source = spec.default !== void 0 ? 'default' : 'unset';
|
|
190
|
+
const base = {
|
|
191
|
+
key: spec.key,
|
|
192
|
+
spec,
|
|
193
|
+
source
|
|
194
|
+
};
|
|
158
195
|
if (spec.required)
|
|
159
196
|
return {
|
|
160
197
|
...base,
|
|
161
|
-
source,
|
|
162
198
|
status: 'error',
|
|
163
199
|
value: void 0,
|
|
164
200
|
problem: 'is required'
|
|
165
201
|
};
|
|
166
202
|
return {
|
|
167
203
|
...base,
|
|
168
|
-
source,
|
|
169
204
|
status: 'ok',
|
|
170
205
|
value: spec.default
|
|
171
206
|
};
|
|
172
207
|
}
|
|
173
|
-
const
|
|
208
|
+
const alias = found.name === spec.key ? void 0 : found.name;
|
|
209
|
+
const source = alias ? 'alias' : 'env';
|
|
210
|
+
const base = {
|
|
211
|
+
key: spec.key,
|
|
212
|
+
spec,
|
|
213
|
+
source,
|
|
214
|
+
...(alias ? { alias } : {})
|
|
215
|
+
};
|
|
216
|
+
const parsed = parse(spec, found.raw);
|
|
174
217
|
if (parsed.ok)
|
|
175
218
|
return {
|
|
176
219
|
...base,
|
|
177
|
-
source,
|
|
178
220
|
status: 'ok',
|
|
179
221
|
value: parsed.value
|
|
180
222
|
};
|
|
181
223
|
if (spec.onInvalid === 'fail')
|
|
182
224
|
return {
|
|
183
225
|
...base,
|
|
184
|
-
source,
|
|
185
226
|
status: 'error',
|
|
186
227
|
value: void 0,
|
|
187
228
|
problem: parsed.problem
|
|
188
229
|
};
|
|
189
230
|
return {
|
|
190
231
|
...base,
|
|
191
|
-
source,
|
|
192
232
|
status: 'invalid',
|
|
193
233
|
value: spec.default,
|
|
194
234
|
problem: parsed.problem
|
|
@@ -263,7 +303,6 @@ function buildConfigReport(manifest, env, options = {}) {
|
|
|
263
303
|
const resolved = resolveConfig(manifest, env, options);
|
|
264
304
|
const rows = manifest.map((spec) => {
|
|
265
305
|
const k = resolved.keys[spec.key];
|
|
266
|
-
const raw = k.source === 'alias' ? env[k.alias] : env[spec.key];
|
|
267
306
|
return {
|
|
268
307
|
key: spec.key,
|
|
269
308
|
...(spec.label ? { label: spec.label } : {}),
|
|
@@ -277,7 +316,7 @@ function buildConfigReport(manifest, env, options = {}) {
|
|
|
277
316
|
...(spec.impact ? { impact: spec.impact } : {}),
|
|
278
317
|
source: k.source,
|
|
279
318
|
status: k.status,
|
|
280
|
-
display: display(spec
|
|
319
|
+
display: display(spec, k, rawValue(spec, env)?.raw),
|
|
281
320
|
...(k.problem ? { problem: k.problem } : {}),
|
|
282
321
|
...(k.alias ? { alias: k.alias } : {})
|
|
283
322
|
};
|
|
@@ -288,12 +327,11 @@ function buildConfigReport(manifest, env, options = {}) {
|
|
|
288
327
|
unknown: resolved.unknown
|
|
289
328
|
};
|
|
290
329
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
if (
|
|
294
|
-
if (sensitive) return 'set';
|
|
295
|
-
|
|
296
|
-
return raw.trim();
|
|
330
|
+
/** `raw` is the env text the value came from, undefined when it is the default. */
|
|
331
|
+
function display(spec, k, raw) {
|
|
332
|
+
if (k.source === 'unset') return '';
|
|
333
|
+
if (spec.sensitive) return raw !== void 0 && spec.generated ? fingerprint(raw) : 'set';
|
|
334
|
+
return raw === void 0 ? formatValue(k.value) : raw.trim();
|
|
297
335
|
}
|
|
298
336
|
function formatValue(value) {
|
|
299
337
|
if (Array.isArray(value)) return value.join(',');
|
|
@@ -304,29 +342,36 @@ function fingerprint(value) {
|
|
|
304
342
|
return `sha256:${createHash('sha256').update(value.trim()).digest('hex').slice(0, 8)}`;
|
|
305
343
|
}
|
|
306
344
|
// ../platform/src/config/snapshot.ts
|
|
307
|
-
|
|
345
|
+
var SENSITIVE_MARKER = 'set';
|
|
346
|
+
function takeSnapshot(manifest, env, salt) {
|
|
347
|
+
const key = typeof salt === 'string' && salt !== '' ? salt : randomBytes(16).toString('hex');
|
|
308
348
|
const values = {};
|
|
309
349
|
const sensitive = [];
|
|
310
350
|
for (const spec of manifest) {
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
);
|
|
314
|
-
if (name === void 0) continue;
|
|
315
|
-
const raw = env[name].trim();
|
|
351
|
+
const found = rawValue(spec, env);
|
|
352
|
+
if (!found) continue;
|
|
353
|
+
const raw = found.raw.trim();
|
|
316
354
|
if (spec.sensitive) {
|
|
317
|
-
values[spec.key] =
|
|
355
|
+
values[spec.key] = spec.generated
|
|
356
|
+
? createHmac('sha256', key).update(raw).digest('hex').slice(0, 16)
|
|
357
|
+
: SENSITIVE_MARKER;
|
|
318
358
|
sensitive.push(spec.key);
|
|
319
359
|
} else values[spec.key] = raw;
|
|
320
360
|
}
|
|
321
361
|
return {
|
|
322
362
|
version: 1,
|
|
323
|
-
salt,
|
|
363
|
+
salt: key,
|
|
324
364
|
values,
|
|
325
365
|
sensitive
|
|
326
366
|
};
|
|
327
367
|
}
|
|
328
|
-
/**
|
|
368
|
+
/**
|
|
369
|
+
* What changed since `before`, the previous snapshot as read from disk; anything
|
|
370
|
+
* that is not a snapshot counts as none. Take `after` with `before.salt`, or every
|
|
371
|
+
* generated key reads as changed.
|
|
372
|
+
*/
|
|
329
373
|
function diffSnapshots(before, after) {
|
|
374
|
+
if (!isSnapshot(before)) return [];
|
|
330
375
|
const secret = /* @__PURE__ */ new Set([...before.sensitive, ...after.sensitive]);
|
|
331
376
|
const changes = [];
|
|
332
377
|
const plain = (key, from, to) =>
|
|
@@ -360,9 +405,25 @@ function diffSnapshots(before, after) {
|
|
|
360
405
|
});
|
|
361
406
|
return changes;
|
|
362
407
|
}
|
|
408
|
+
function isSnapshot(value) {
|
|
409
|
+
if (typeof value !== 'object' || value === null) return false;
|
|
410
|
+
const { version, salt, values, sensitive } = value;
|
|
411
|
+
return (
|
|
412
|
+
version === 1 &&
|
|
413
|
+
typeof salt === 'string' &&
|
|
414
|
+
salt !== '' &&
|
|
415
|
+
typeof values === 'object' &&
|
|
416
|
+
values !== null &&
|
|
417
|
+
!Array.isArray(values) &&
|
|
418
|
+
Object.values(values).every((v) => typeof v === 'string') &&
|
|
419
|
+
Array.isArray(sensitive) &&
|
|
420
|
+
sensitive.every((k) => typeof k === 'string')
|
|
421
|
+
);
|
|
422
|
+
}
|
|
363
423
|
// ../platform/src/config/previous-key.ts
|
|
364
424
|
/** How long `selva keys rotate` keeps the previous key accepted. */
|
|
365
425
|
var PREVIOUS_KEY_DAYS = 30;
|
|
426
|
+
var MAX_DEADLINE_DAYS = 90;
|
|
366
427
|
var DAY_MS = 864e5;
|
|
367
428
|
/**
|
|
368
429
|
* The previous key for `base` (`SELVA_HMAC_KEY` or `SELVA_AT_REST_KEY`), if it
|
|
@@ -378,8 +439,8 @@ function previousKey(env, base, now = Date.now()) {
|
|
|
378
439
|
state: 'no-deadline',
|
|
379
440
|
key
|
|
380
441
|
};
|
|
381
|
-
const at =
|
|
382
|
-
if (
|
|
442
|
+
const at = parseDeadline(expires);
|
|
443
|
+
if (at === null || at <= now || at - now > MAX_DEADLINE_DAYS * DAY_MS)
|
|
383
444
|
return {
|
|
384
445
|
state: 'expired',
|
|
385
446
|
expires
|
|
@@ -391,32 +452,34 @@ function previousKey(env, base, now = Date.now()) {
|
|
|
391
452
|
daysLeft: Math.ceil((at - now) / DAY_MS)
|
|
392
453
|
};
|
|
393
454
|
}
|
|
394
|
-
|
|
455
|
+
var ISO_DEADLINE =
|
|
456
|
+
/^(\d{4})-(\d{2})-(\d{2})(?:T([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d)(\.\d+)?)?(Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)?)?$/;
|
|
395
457
|
/**
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
* The app wires a real logger at its composition root; a consumer that wires
|
|
399
|
-
* nothing gets silence rather than unsolicited stdout writes.
|
|
458
|
+
* `YYYY-MM-DD`, or an ISO timestamp, UTC unless it names an offset. Not
|
|
459
|
+
* `Date.parse`: it reads `12.1.2027` as 1 December and rolls `2026-11-31` over.
|
|
400
460
|
*/
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
461
|
+
function parseDeadline(text) {
|
|
462
|
+
const m = ISO_DEADLINE.exec(text);
|
|
463
|
+
if (!m) return null;
|
|
464
|
+
const [, year, month, day, hour = '0', minute = '0', second = '0', fraction = '', zone = 'Z'] = m;
|
|
465
|
+
const midnight = Date.UTC(Number(year), Number(month) - 1, Number(day));
|
|
466
|
+
const date = new Date(midnight);
|
|
467
|
+
if (
|
|
468
|
+
date.getUTCFullYear() !== Number(year) ||
|
|
469
|
+
date.getUTCMonth() !== Number(month) - 1 ||
|
|
470
|
+
date.getUTCDate() !== Number(day)
|
|
471
|
+
)
|
|
472
|
+
return null;
|
|
473
|
+
const offsetMinutes =
|
|
474
|
+
zone === 'Z'
|
|
475
|
+
? 0
|
|
476
|
+
: (zone.startsWith('-') ? -1 : 1) * (Number(zone.slice(1, 3)) * 60 + Number(zone.slice(4)));
|
|
477
|
+
return (
|
|
478
|
+
midnight +
|
|
479
|
+
((Number(hour) * 60 + Number(minute) - offsetMinutes) * 60 + Number(second)) * 1e3 +
|
|
480
|
+
Math.floor(Number(`0${fraction}`) * 1e3)
|
|
481
|
+
);
|
|
482
|
+
}
|
|
420
483
|
// ../server/src/config/settings.ts
|
|
421
484
|
var flag = (key, label, description, impact) =>
|
|
422
485
|
defineSetting({
|
|
@@ -442,6 +505,95 @@ var tunableInt = (key, fallback, label, description, extra = {}) =>
|
|
|
442
505
|
...extra
|
|
443
506
|
});
|
|
444
507
|
var MB = 1048576;
|
|
508
|
+
var SIGN_IN_MAX_AGE_SETTING = defineSetting({
|
|
509
|
+
key: 'SIGN_IN_MAX_AGE_DAYS',
|
|
510
|
+
label: 'Force sign-in again after',
|
|
511
|
+
type: 'int',
|
|
512
|
+
min: 0,
|
|
513
|
+
default: 0,
|
|
514
|
+
onInvalid: 'fail',
|
|
515
|
+
class: 'setting',
|
|
516
|
+
summary: true,
|
|
517
|
+
zero: 'Never',
|
|
518
|
+
unit: 'days',
|
|
519
|
+
description: 'Days before users must sign in at the identity provider again. 0 is never.',
|
|
520
|
+
impact: 'API tokens of anyone who has not signed in within this many days are revoked.'
|
|
521
|
+
});
|
|
522
|
+
var COMPUTE_LIMIT_SETTINGS = composeManifest([
|
|
523
|
+
tunableInt(
|
|
524
|
+
'COMPUTE_RATE_LIMIT_MAX',
|
|
525
|
+
120,
|
|
526
|
+
'Solves per window',
|
|
527
|
+
'Solves per user or share link per 100-second window.'
|
|
528
|
+
),
|
|
529
|
+
tunableInt('MAX_DEFINITION_FILE_SIZE_BYTES', 50 * MB, 'Max .gh upload', 'Largest .gh upload.', {
|
|
530
|
+
unit: 'bytes'
|
|
531
|
+
}),
|
|
532
|
+
tunableInt(
|
|
533
|
+
'COMPUTE_MAX_QUEUE_DEPTH',
|
|
534
|
+
0,
|
|
535
|
+
'Solve queue length',
|
|
536
|
+
'Solves allowed to wait per compute server. 0 is unbounded.',
|
|
537
|
+
{
|
|
538
|
+
min: 0,
|
|
539
|
+
zero: 'No limit'
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
tunableInt(
|
|
543
|
+
'COMPUTE_QUEUE_WAIT_MS',
|
|
544
|
+
0,
|
|
545
|
+
'Max queue wait',
|
|
546
|
+
'Longest a solve may wait queued. 0 is no deadline.',
|
|
547
|
+
{
|
|
548
|
+
min: 0,
|
|
549
|
+
unit: 'ms',
|
|
550
|
+
zero: 'No limit'
|
|
551
|
+
}
|
|
552
|
+
),
|
|
553
|
+
tunableInt(
|
|
554
|
+
'COMPUTE_DEFINITION_CACHE_MB',
|
|
555
|
+
256,
|
|
556
|
+
'Definition cache size',
|
|
557
|
+
'Definition cache budget. 0 turns it off.',
|
|
558
|
+
{
|
|
559
|
+
min: 0,
|
|
560
|
+
unit: 'mb',
|
|
561
|
+
zero: 'Off',
|
|
562
|
+
aliases: ['COMPUTE_DEFINITION_BYTE_CACHE_MB']
|
|
563
|
+
}
|
|
564
|
+
),
|
|
565
|
+
tunableInt(
|
|
566
|
+
'COMPUTE_SOLVE_CACHE_MB',
|
|
567
|
+
256,
|
|
568
|
+
'Solve cache size',
|
|
569
|
+
'Solve cache budget per warm compute server. 0 turns it off.',
|
|
570
|
+
{
|
|
571
|
+
min: 0,
|
|
572
|
+
unit: 'mb',
|
|
573
|
+
zero: 'Off',
|
|
574
|
+
aliases: ['COMPUTE_RESPONSE_CACHE_MB']
|
|
575
|
+
}
|
|
576
|
+
),
|
|
577
|
+
defineSetting({
|
|
578
|
+
key: 'COMPUTE_SERVER_CACHESOLVE',
|
|
579
|
+
label: 'Compute server solve cache',
|
|
580
|
+
type: 'bool',
|
|
581
|
+
default: true,
|
|
582
|
+
onInvalid: 'default',
|
|
583
|
+
class: 'tunable',
|
|
584
|
+
description: 'Ask Rhino.Compute to cache solve results server-side.'
|
|
585
|
+
})
|
|
586
|
+
]);
|
|
587
|
+
var API_TOKEN_RATE_LIMIT_SETTING = tunableInt(
|
|
588
|
+
'API_TOKEN_RATE_LIMIT_MAX',
|
|
589
|
+
600,
|
|
590
|
+
'API requests per minute',
|
|
591
|
+
'Requests per API token per minute. 0 is off.',
|
|
592
|
+
{
|
|
593
|
+
min: 0,
|
|
594
|
+
zero: 'Off'
|
|
595
|
+
}
|
|
596
|
+
);
|
|
445
597
|
var ENGINE_SETTINGS = composeManifest([
|
|
446
598
|
...[
|
|
447
599
|
[
|
|
@@ -581,20 +733,7 @@ var ENGINE_SETTINGS = composeManifest([
|
|
|
581
733
|
description:
|
|
582
734
|
'While no instance admin exists, only this address may become one. For first setup and lockouts.'
|
|
583
735
|
}),
|
|
584
|
-
|
|
585
|
-
key: 'SIGN_IN_MAX_AGE_DAYS',
|
|
586
|
-
label: 'Force sign-in again after',
|
|
587
|
-
type: 'int',
|
|
588
|
-
min: 0,
|
|
589
|
-
default: 0,
|
|
590
|
-
onInvalid: 'fail',
|
|
591
|
-
class: 'setting',
|
|
592
|
-
summary: true,
|
|
593
|
-
zero: 'Never',
|
|
594
|
-
unit: 'days',
|
|
595
|
-
description: 'Days before users must sign in at the identity provider again. 0 is never.',
|
|
596
|
-
impact: 'API tokens of anyone who has not signed in within this many days are revoked.'
|
|
597
|
-
}),
|
|
736
|
+
SIGN_IN_MAX_AGE_SETTING,
|
|
598
737
|
flag('ALLOW_ORG_CREATION', 'Users create orgs', 'Self-service org creation (read by host apps).'),
|
|
599
738
|
flag(
|
|
600
739
|
'ALLOW_CROSS_ORG_PUBLIC',
|
|
@@ -688,79 +827,8 @@ var ENGINE_SETTINGS = composeManifest([
|
|
|
688
827
|
description: 'Override the TLS mode inferred from the port.',
|
|
689
828
|
legacy: { bool: 'exact-true' }
|
|
690
829
|
}),
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
120,
|
|
694
|
-
'Solves per window',
|
|
695
|
-
'Solves per user or share link per 100-second window.'
|
|
696
|
-
),
|
|
697
|
-
tunableInt('MAX_DEFINITION_FILE_SIZE_BYTES', 50 * MB, 'Max .gh upload', 'Largest .gh upload.', {
|
|
698
|
-
unit: 'bytes'
|
|
699
|
-
}),
|
|
700
|
-
tunableInt(
|
|
701
|
-
'COMPUTE_MAX_QUEUE_DEPTH',
|
|
702
|
-
0,
|
|
703
|
-
'Solve queue length',
|
|
704
|
-
'Solves allowed to wait per compute server. 0 is unbounded.',
|
|
705
|
-
{
|
|
706
|
-
min: 0,
|
|
707
|
-
zero: 'No limit'
|
|
708
|
-
}
|
|
709
|
-
),
|
|
710
|
-
tunableInt(
|
|
711
|
-
'COMPUTE_QUEUE_WAIT_MS',
|
|
712
|
-
0,
|
|
713
|
-
'Max queue wait',
|
|
714
|
-
'Longest a solve may wait queued. 0 is no deadline.',
|
|
715
|
-
{
|
|
716
|
-
min: 0,
|
|
717
|
-
unit: 'ms',
|
|
718
|
-
zero: 'No limit'
|
|
719
|
-
}
|
|
720
|
-
),
|
|
721
|
-
tunableInt(
|
|
722
|
-
'COMPUTE_DEFINITION_CACHE_MB',
|
|
723
|
-
256,
|
|
724
|
-
'Definition cache size',
|
|
725
|
-
'Definition cache budget. 0 turns it off.',
|
|
726
|
-
{
|
|
727
|
-
min: 0,
|
|
728
|
-
unit: 'mb',
|
|
729
|
-
zero: 'Off',
|
|
730
|
-
aliases: ['COMPUTE_DEFINITION_BYTE_CACHE_MB']
|
|
731
|
-
}
|
|
732
|
-
),
|
|
733
|
-
tunableInt(
|
|
734
|
-
'COMPUTE_SOLVE_CACHE_MB',
|
|
735
|
-
256,
|
|
736
|
-
'Solve cache size',
|
|
737
|
-
'Solve cache budget per warm compute server. 0 turns it off.',
|
|
738
|
-
{
|
|
739
|
-
min: 0,
|
|
740
|
-
unit: 'mb',
|
|
741
|
-
zero: 'Off',
|
|
742
|
-
aliases: ['COMPUTE_RESPONSE_CACHE_MB']
|
|
743
|
-
}
|
|
744
|
-
),
|
|
745
|
-
defineSetting({
|
|
746
|
-
key: 'COMPUTE_SERVER_CACHESOLVE',
|
|
747
|
-
label: 'Compute server solve cache',
|
|
748
|
-
type: 'bool',
|
|
749
|
-
default: true,
|
|
750
|
-
onInvalid: 'default',
|
|
751
|
-
class: 'tunable',
|
|
752
|
-
description: 'Ask Rhino.Compute to cache solve results server-side.'
|
|
753
|
-
}),
|
|
754
|
-
tunableInt(
|
|
755
|
-
'API_TOKEN_RATE_LIMIT_MAX',
|
|
756
|
-
DEFAULT_API_RATE_LIMIT.maxPerWindow,
|
|
757
|
-
'API requests per minute',
|
|
758
|
-
'Requests per API token per minute. 0 is off.',
|
|
759
|
-
{
|
|
760
|
-
min: 0,
|
|
761
|
-
zero: 'Off'
|
|
762
|
-
}
|
|
763
|
-
)
|
|
830
|
+
COMPUTE_LIMIT_SETTINGS,
|
|
831
|
+
API_TOKEN_RATE_LIMIT_SETTING
|
|
764
832
|
]);
|
|
765
833
|
// ../providers/header-auth/src/config.ts
|
|
766
834
|
var header = (key, fallback, slot) =>
|
|
@@ -901,12 +969,24 @@ var SUPABASE_SETTINGS = composeManifest([
|
|
|
901
969
|
})
|
|
902
970
|
]);
|
|
903
971
|
// src/lib/server/config/settings.ts
|
|
972
|
+
var COMPUTE_DEBUG = defineSetting({
|
|
973
|
+
key: 'SELVA_FLAG_COMPUTE_DEBUG',
|
|
974
|
+
label: 'Compute debug logging',
|
|
975
|
+
type: 'string',
|
|
976
|
+
default: 'off',
|
|
977
|
+
onInvalid: 'default',
|
|
978
|
+
class: 'setting',
|
|
979
|
+
description:
|
|
980
|
+
'off, on (cache and timing lines per solve) or verbose (adds Compute’s raw error bodies).',
|
|
981
|
+
impact: 'verbose can write what was solved to the log, which erasure cannot reach.'
|
|
982
|
+
});
|
|
904
983
|
/** Keys only this app reads. adapter-node's own keys are here too: they decide whether it works. */
|
|
905
984
|
var APP_SETTINGS = composeManifest([
|
|
906
985
|
defineSetting({
|
|
907
986
|
key: 'ORIGIN',
|
|
908
987
|
label: 'Public address',
|
|
909
988
|
type: 'url',
|
|
989
|
+
origin: true,
|
|
910
990
|
onInvalid: 'fail',
|
|
911
991
|
class: 'bootstrap',
|
|
912
992
|
summary: true,
|
|
@@ -1016,6 +1096,7 @@ var APP_SETTINGS = composeManifest([
|
|
|
1016
1096
|
key: 'SELVA_EVENT_CALLBACK_ORIGIN',
|
|
1017
1097
|
label: 'Solve event callback address',
|
|
1018
1098
|
type: 'url',
|
|
1099
|
+
origin: true,
|
|
1019
1100
|
onInvalid: 'fail',
|
|
1020
1101
|
class: 'bootstrap',
|
|
1021
1102
|
description:
|
|
@@ -1039,17 +1120,7 @@ var APP_SETTINGS = composeManifest([
|
|
|
1039
1120
|
class: 'setting',
|
|
1040
1121
|
description: 'Lowest severity written to the log. Default info (debug in development).'
|
|
1041
1122
|
}),
|
|
1042
|
-
|
|
1043
|
-
key: 'SELVA_FLAG_COMPUTE_DEBUG',
|
|
1044
|
-
label: 'Compute debug logging',
|
|
1045
|
-
type: 'string',
|
|
1046
|
-
default: 'off',
|
|
1047
|
-
onInvalid: 'default',
|
|
1048
|
-
class: 'setting',
|
|
1049
|
-
description:
|
|
1050
|
-
'off, on (cache and timing lines per solve) or verbose (adds Compute’s raw error bodies).',
|
|
1051
|
-
impact: 'verbose can write what was solved to the log, which erasure cannot reach.'
|
|
1052
|
-
}),
|
|
1123
|
+
COMPUTE_DEBUG,
|
|
1053
1124
|
defineSetting({
|
|
1054
1125
|
key: 'SENTRY_DSN',
|
|
1055
1126
|
label: 'Sentry error reporting',
|