fix(wizard): emit per-decky service config sections instead of prefix group
[decky.https] relied on ini_loader prefix-matching to propagate config to decky-03/04/05 — silent and fragile. Now emits [decky-03.https], [decky-04.https], [decky-05.https] explicitly so the INI is self-evident and doesn't depend on pattern matching side-effects.
This commit is contained in:
@@ -59,29 +59,29 @@ const buildIni = (
|
|||||||
}
|
}
|
||||||
if (mutate) lines.push(`mutate_interval=${mutateEvery}`);
|
if (mutate) lines.push(`mutate_interval=${mutateEvery}`);
|
||||||
lines.push('');
|
lines.push('');
|
||||||
}
|
|
||||||
// Per-service overrides emitted as [<prefix>.<svc>] group subsections.
|
// Emit per-service config as [<exact-decky-name>.<svc>] so the section
|
||||||
// The INI loader (decnet/ini_loader.py) prefix-matches these onto every
|
// name unambiguously targets this decky only — no prefix-match magic.
|
||||||
// ``${prefix}-NN`` decky in the batch, so one block covers all clones.
|
for (const svc of services) {
|
||||||
for (const svc of services) {
|
const cfg = serviceConfigs[svc];
|
||||||
const cfg = serviceConfigs[svc];
|
if (!cfg || Object.keys(cfg).length === 0) continue;
|
||||||
if (!cfg || Object.keys(cfg).length === 0) continue;
|
const fieldTypes: Record<string, SvcFieldDTO['type']> = {};
|
||||||
const fieldTypes: Record<string, SvcFieldDTO['type']> = {};
|
for (const f of serviceSchemas[svc] ?? []) fieldTypes[f.key] = f.type;
|
||||||
for (const f of serviceSchemas[svc] ?? []) fieldTypes[f.key] = f.type;
|
lines.push(`[${name}.${svc}]`);
|
||||||
lines.push(`[${prefix}.${svc}]`);
|
for (const [k, v] of Object.entries(cfg)) {
|
||||||
for (const [k, v] of Object.entries(cfg)) {
|
// textarea values may contain newlines that ConfigParser can't carry
|
||||||
// textarea values may contain newlines that ConfigParser can't carry
|
// on a single line; wrap them in `b64:` so validate_cfg decodes back
|
||||||
// on a single line; wrap them in `b64:` so validate_cfg decodes back
|
// to the original UTF-8 string. Other types are emitted raw.
|
||||||
// to the original UTF-8 string. Other types are emitted raw.
|
let serialised: string;
|
||||||
let serialised: string;
|
if (fieldTypes[k] === 'textarea' && typeof v === 'string') {
|
||||||
if (fieldTypes[k] === 'textarea' && typeof v === 'string') {
|
serialised = `b64:${b64encodeUtf8(v)}`;
|
||||||
serialised = `b64:${b64encodeUtf8(v)}`;
|
} else {
|
||||||
} else {
|
serialised = typeof v === 'string' ? v : String(v);
|
||||||
serialised = typeof v === 'string' ? v : String(v);
|
}
|
||||||
|
lines.push(`${k}=${serialised}`);
|
||||||
}
|
}
|
||||||
lines.push(`${k}=${serialised}`);
|
lines.push('');
|
||||||
}
|
}
|
||||||
lines.push('');
|
|
||||||
}
|
}
|
||||||
return lines.join('\n');
|
return lines.join('\n');
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user