mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-01 00:13:37 +00:00
fix: drop the connector address setting that nothing used
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// @vitest-environment node
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { CONFIG_ENV_MAP } from '../types';
|
||||
|
||||
const ROOT = path.resolve(__dirname, '../../..');
|
||||
const SKIP = new Set(['node_modules', '.next', '.git', 'repos', 'local-data', 'integration', '__tests__', 'out', 'public']);
|
||||
|
||||
function sourceFiles(dir = ROOT, out: string[] = []): string[] {
|
||||
for (const name of readdirSync(dir)) {
|
||||
if (SKIP.has(name)) continue;
|
||||
const full = path.join(dir, name);
|
||||
if (statSync(full).isDirectory()) sourceFiles(full, out);
|
||||
else if (/\.(ts|tsx|mjs)$/.test(name)) out.push(full);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
describe('admin config map', () => {
|
||||
// A key in the map shows up in the admin API and can be saved, so one that
|
||||
// nothing reads is a setting that silently does nothing.
|
||||
it('has no key that nothing outside the map reads', () => {
|
||||
const typesFile = path.join(ROOT, 'lib', 'admin', 'types.ts');
|
||||
const texts = sourceFiles().filter((f) => f !== typesFile).map((f) => readFileSync(f, 'utf8'));
|
||||
const unread = Object.keys(CONFIG_ENV_MAP).filter(
|
||||
(key) => !texts.some((text) => new RegExp(`\\b${key}\\b`).test(text)),
|
||||
);
|
||||
expect(unread).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -77,7 +77,7 @@ export const OUTGOING_HOSTS: readonly OutgoingHost[] = [
|
||||
{
|
||||
id: 'connector',
|
||||
host: 'connector.bulwarkmail.org',
|
||||
files: ['lib/admin/types.ts', 'lib/connector/registry.ts'],
|
||||
files: ['lib/connector/registry.ts'],
|
||||
side: 'server',
|
||||
usedBy: 'Links in the docs and the directory that open this instance; the connector asks this server what it can open.',
|
||||
off: 'CONNECTOR_ENABLED=false.',
|
||||
|
||||
+5
-6
@@ -374,13 +374,12 @@ export const CONFIG_ENV_MAP: Record<string, { envVar: string; fileEnvVar?: strin
|
||||
extensionDirectoryChannel: { envVar: 'EXTENSION_DIRECTORY_CHANNEL', type: 'enum', defaultValue: 'stable', enumValues: ['stable', 'beta'] },
|
||||
// Connector links (connector.bulwarkmail.org): docs and the extension
|
||||
// directory link to a destination, and the reader's own browser resolves it
|
||||
// to their instance. `connectorEnabled` covers both halves - the
|
||||
// /api/connector/capabilities endpoint a connector probes, and the "add this
|
||||
// instance" links the app offers - so a deployment that wants no third-party
|
||||
// hostname anywhere can switch the whole thing off. `connectorUrl` points a
|
||||
// white-label or self-hosted deployment at its own connector.
|
||||
// to their instance. `connectorEnabled` switches off the
|
||||
// /api/connector/capabilities endpoint a connector probes, for deployments
|
||||
// that would rather not answer it. There is no setting for the connector's
|
||||
// address: the instance never builds a connector link, it only answers the
|
||||
// probe and opens /connector/<target>.
|
||||
connectorEnabled: { envVar: 'CONNECTOR_ENABLED', type: 'boolean', defaultValue: true },
|
||||
connectorUrl: { envVar: 'CONNECTOR_URL', type: 'url', defaultValue: 'https://connector.bulwarkmail.org' },
|
||||
// Fail-closed "no third-party traffic" mode (#903): every built-in outside
|
||||
// host in lib/outgoing-hosts.ts is off (telemetry, version check, the
|
||||
// built-in push relay, the official extension directory, the connector,
|
||||
|
||||
Reference in New Issue
Block a user