Revert the document-server link of nextcloud and only-office (mesh-catalog #438): since its merge at 11:49 novox cannot be resolved, so no machine can get new instructions (issue 1830)
mesh/delivery stopped: the pull request closed unmerged
mesh/merge-gate error: builds nextcloud, only-office → novox; no bus step; the check could not run: build-1792666287056161072-store never became ready
mesh/repo-check error: the check could not run: build-1792666287056161072-store never became ready
mesh/check failed: unit: modules/gitea.test: [gitea] where the poll of merges last looked from could not be read, so none is kept — no runtime | 2e414…

This commit is contained in:
2026-10-22 12:51:10 +02:00
parent b7b9f2a3da
commit 2e4144213b
8 changed files with 6 additions and 350 deletions
-68
View File
@@ -43,24 +43,6 @@ function ignoreSecretSetting(cfg: Record<string, unknown>, key: string): void {
console.error(`the setting ${key} is ignored: it comes from the vault`);
}
/** What applyOnlyOffice changed and whether it checked the connection (novox/hq issue 1830). */
export interface OnlyOfficeResult {
/** The onlyoffice occ keys that were set this call — key names only, never a value. */
changed: string[];
/** Whether `onlyoffice:documentserver --check` ran, and passed; absent when nothing changed. */
checkOk?: boolean;
}
// occ's config key, and the mesh-delivered config.json key it comes from (files/config.json).
const ONLYOFFICE_KEYS: ReadonlyArray<readonly [occKey: string, configKey: string]> = [
["DocumentServerUrl", "onlyofficeUrl"],
["DocumentServerInternalUrl", "onlyofficeInternalUrl"],
["StorageUrl", "onlyofficeStorageUrl"],
["jwt_secret", "onlyofficeSecret"],
];
let saidOnlyOfficeNotGiven = false;
export class NextcloudClient {
constructor(
private readonly container: string,
@@ -104,56 +86,6 @@ export class NextcloudClient {
}
}
/**
* Applies OnlyOffice's settings from the mesh-delivered config (novox/hq issue 1830), read fresh
* from the config file on every call. Sets only the occ keys that differ from Nextcloud's current
* ones, then runs the connection check once something changed. When any of the four values is not
* given yet (document-server not bound, or its secret not given), changes nothing and says so once
* — never on every call. Never logs, returns or emits the secret's value: `changed` holds key names
* only, `jwt_secret` among them, never jwt_secret's value.
*/
applyOnlyOffice(configFile: string | undefined = process.env.MESH_NEXTCLOUD_CONFIG_FILE): OnlyOfficeResult {
const cfg = meshConfig(configFile);
const desired = ONLYOFFICE_KEYS.map(([occKey, configKey]) => [occKey, cfg[configKey] ?? ""] as const);
if (desired.some(([, value]) => !value)) {
if (!saidOnlyOfficeNotGiven) {
saidOnlyOfficeNotGiven = true;
console.error("onlyoffice: document-server is not bound yet, or its secret is not given yet — nothing applied");
}
return { changed: [] };
}
const changed: string[] = [];
for (const [occKey, value] of desired) {
if (this.currentAppConfig(occKey) !== value) {
this.occ(["config:app:set", "onlyoffice", occKey, `--value=${value}`]);
changed.push(occKey);
}
}
if (changed.length === 0) return { changed };
let checkOk = true;
try {
this.occ(["onlyoffice:documentserver", "--check"]);
} catch {
checkOk = false;
}
return { changed, checkOk };
}
/**
* config:app:get of a key onlyoffice never set can throw occ's own "produced no output" error
* (occ above) rather than answer an empty string; read either as unset, so a first run sets it
* rather than aborting the loop.
*/
private currentAppConfig(key: string): string {
try {
return this.occ(["config:app:get", "onlyoffice", key]);
} catch {
return "";
}
}
listUsers(): NextcloudUser[] {
// user:list --output=json answers an object of uid → display name.
const raw = this.occ(["user:list", "--output=json"]);