@camstack/server 1.2.798 → 1.2.799

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.799] - 2026-11-07
11
+
12
+ ### Changed
13
+
14
+ - The bootstrap config is the environment (CAMSTACK_PORT, CAMSTACK_HOST, CAMSTACK_DATA); config.yaml is no longer read, a leftover file with different values is still applied for this release with a warning naming the variable to set
15
+
10
16
  ## [1.2.798] - 2026-11-07
11
17
 
12
18
  ### Changed
@@ -84,12 +84,12 @@ function ignoredTlsCertSources(env) {
84
84
  // loadBootstrapConfig
85
85
  // ---------------------------------------------------------------------------
86
86
  /**
87
- * The kernel's bootstrap loader (config.yaml + `CAMSTACK_PORT` / `HOST` /
88
- * `DATA`) — the ONE loader — plus a boot warning for the retired HTTPS
87
+ * The kernel's bootstrap loader (`CAMSTACK_PORT` / `HOST` /
88
+ * `DATA` over built-in defaults) — the ONE loader — plus a boot warning for the retired HTTPS
89
89
  * variables still set, so a container template that carries one is told.
90
90
  */
91
- function loadBootstrapConfig(configPath) {
92
- const config = (0, system_1.loadBootstrapConfig)(configPath, { warnRetiredKeys: true });
91
+ function loadBootstrapConfig() {
92
+ const config = (0, system_1.loadBootstrapConfig)();
93
93
  const env = process.env;
94
94
  const retiredTls = retiredTlsEnabledSources(env);
95
95
  if (retiredTls.length > 0) {
@@ -110,7 +110,7 @@ function loadBootstrapConfig(configPath) {
110
110
  * Phase 2: Create StorageLocationManager, ensure directories, configure TLS.
111
111
  * Returns the full InfraContext needed by subsequent boot phases.
112
112
  */
113
- async function setupInfra(configPath, bootstrapConfig) {
113
+ async function setupInfra(bootstrapConfig) {
114
114
  // No secret is generated here: the session signing key is the keychain's
115
115
  // (local-auth loads or creates it once the keychain is up — D797).
116
116
  const config = bootstrapConfig;
@@ -164,7 +164,6 @@ async function setupInfra(configPath, bootstrapConfig) {
164
164
  tlsOptions = { key: boot.pair.key, cert: boot.pair.cert };
165
165
  }
166
166
  return {
167
- configPath,
168
167
  bootstrapConfig: config,
169
168
  dataPath,
170
169
  locationManager,
package/dist/main.js CHANGED
@@ -373,21 +373,16 @@ async function bootstrap() {
373
373
  // SPA fallback — set later when admin UI is resolved, used by addon route catch-all
374
374
  let spaIndexHtml = null;
375
375
  // --- Phase 1 + 2: Load config, setup storage locations, TLS ---
376
- // Resolution order: explicit CONFIG_PATH wins (lets operators put the
377
- // bootstrap config on its own mount, e.g. a /config volume). Otherwise
378
- // default it UNDER the data root (CAMSTACK_DATA) so a plain data-dir mount
379
- // also persists config.yaml. Falls back to the historical cwd-relative
380
- // path for local/dev runs where neither env var is set.
381
- const configPath = process.env.CONFIG_PATH ??
382
- path.join(process.env.CAMSTACK_DATA ?? path.join(process.cwd(), 'camstack-data'), 'config.yaml');
383
- const bootstrapConfig = (0, boot_config_1.loadBootstrapConfig)(configPath);
384
- const infra = await (0, boot_config_1.setupInfra)(configPath, bootstrapConfig);
376
+ // The bootstrap config is the environment (CAMSTACK_PORT / HOST / DATA) over
377
+ // built-in defaults; there is no config.yaml (D1018).
378
+ const bootstrapConfig = (0, boot_config_1.loadBootstrapConfig)();
379
+ const infra = await (0, boot_config_1.setupInfra)(bootstrapConfig);
385
380
  const { dataPath, tlsOptions, tlsCert } = infra;
386
381
  const port = infra.bootstrapConfig.server.port;
387
382
  const host = infra.bootstrapConfig.server.host;
388
383
  // --- Phase 3: Create app + tRPC register + listen ---
389
384
  const fastifyOpts = tlsOptions ? { https: tlsOptions } : {};
390
- const app = await (0, manual_boot_1.bootManual)({ infra, fastifyOpts });
385
+ const app = await (0, manual_boot_1.bootManual)({ fastifyOpts });
391
386
  app.enableShutdownHooks();
392
387
  const fastify = app.getHttpAdapter().getInstance();
393
388
  // Which browser origins may read hub responses, and open the /trpc socket
@@ -1596,7 +1591,7 @@ async function bootstrap() {
1596
1591
  typeof listenErr === 'object' &&
1597
1592
  'code' in listenErr &&
1598
1593
  listenErr.code === 'EADDRINUSE') {
1599
- console.error(`[bootstrap] FATAL: Port ${port} is already in use. Stop the other process or change server.port in config.yaml.`);
1594
+ console.error(`[bootstrap] FATAL: Port ${port} is already in use. Stop the other process or set CAMSTACK_PORT to a free port.`);
1600
1595
  process.exit(1);
1601
1596
  }
1602
1597
  throw listenErr;
@@ -114,11 +114,9 @@ class ServiceContainer {
114
114
  // Manual boot
115
115
  // ---------------------------------------------------------------------------
116
116
  async function bootManual(opts) {
117
- const { infra, fastifyOpts } = opts;
118
- // The same config.yaml main.ts loaded — one path, not a second default.
119
- const configPath = infra.configPath;
117
+ const { fastifyOpts } = opts;
120
118
  // ---- Layer 0: services with no service deps -----------------------------
121
- const configService = new config_service_1.ConfigService(configPath);
119
+ const configService = new config_service_1.ConfigService();
122
120
  const storageService = new storage_service_1.StorageService();
123
121
  const capabilityService = new capability_service_1.CapabilityService();
124
122
  const networkQualityService = new network_quality_service_1.NetworkQualityService();
@@ -61,6 +61,8 @@ const sqlite_restore_js_1 = require("./sqlite-restore.js");
61
61
  /** Path of the manifest file embedded inside every archive. */
62
62
  const ARCHIVE_MANIFEST_NAME = '.camstack-backup-manifest.json';
63
63
  const RESTORE_MARKER_FILE = '.pending-restore.json';
64
+ /** The bootstrap file older archives still carry (D1018): skipped on restore. */
65
+ const RETIRED_CONFIG_FILE = 'config.yaml';
64
66
  /**
65
67
  * Apply a pending system-restore archive over `dataDir` if a marker is
66
68
  * present. Runs BEFORE the addon installer so the restored snapshot's
@@ -121,6 +123,12 @@ async function applyPendingRestore(dataDir, log) {
121
123
  if (p === ARCHIVE_MANIFEST_NAME || p === `./${ARCHIVE_MANIFEST_NAME}`)
122
124
  return false;
123
125
  const normalized = p.replace(/^\.\//, '').replace(/\/+$/, '');
126
+ // An archive from before D1018 carries the retired bootstrap file: it is
127
+ // not restored, or it would resurrect a port the environment now owns.
128
+ if (normalized === RETIRED_CONFIG_FILE) {
129
+ log(`[launcher] Restore: skipping retired ${RETIRED_CONFIG_FILE} (the environment owns the bootstrap config, D1018)`);
130
+ return false;
131
+ }
124
132
  const keep = inScope(normalized);
125
133
  if (keep)
126
134
  extracted.push(normalized);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.798",
3
+ "version": "1.2.799",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,7 +66,8 @@
66
66
  ],
67
67
  "requires": {
68
68
  "addons": {
69
- "@camstack/addon-post-analysis": ">=1.2.682"
69
+ "@camstack/addon-admin-ui": ">=1.2.608",
70
+ "@camstack/addon-agent-ui": ">=1.2.340"
70
71
  },
71
72
  "wrapper": {
72
73
  "desktop": ">=0.0.1",
@@ -75,7 +76,7 @@
75
76
  }
76
77
  },
77
78
  "dependencies": {
78
- "@camstack/addon-admin-ui": "1.2.607",
79
+ "@camstack/addon-admin-ui": "1.2.608",
79
80
  "@camstack/addon-agent-ui": "1.2.339",
80
81
  "@camstack/addon-auth": "1.2.178",
81
82
  "@camstack/addon-benchmark": "1.2.312",
@@ -86,8 +87,8 @@
86
87
  "@camstack/addon-post-analysis": "1.2.682",
87
88
  "@camstack/develop": "0.1.49",
88
89
  "@camstack/sdk": "1.2.156",
89
- "@camstack/types": "1.2.517",
90
- "@camstack/ui-library": "1.2.397",
90
+ "@camstack/types": "1.2.518",
91
+ "@camstack/ui-library": "1.2.398",
91
92
  "@fastify/compress": "^9.0.0",
92
93
  "@fastify/cookie": "^11.0.2",
93
94
  "@fastify/cors": "^11.2.0",
@@ -101,7 +102,6 @@
101
102
  "croner": "^10.0.1",
102
103
  "esbuild": "^0.27.7",
103
104
  "fastify": "^5",
104
- "js-yaml": "^4",
105
105
  "jsonwebtoken": "^9.0.0",
106
106
  "moleculer": "0.15.0",
107
107
  "node-av": "~6.1.0",
@@ -122,7 +122,6 @@
122
122
  },
123
123
  "devDependencies": {
124
124
  "@swc/core": "^1.15.18",
125
- "@types/js-yaml": "^4",
126
125
  "@types/node": "^24",
127
126
  "@types/tar": "^7.0.0",
128
127
  "@types/ws": "^8.18.1",
@@ -10586,13 +10586,13 @@ function createAddonSettingsStore(door, addonId) {
10586
10586
  * the stale rows must still never answer: merging them back in would let a
10587
10587
  * stale DB copy stand in for a credential. The one-off ops script deletes them.
10588
10588
  *
10589
- * So a bootstrap-owned section is answered from env + config.yaml ONLY, and
10589
+ * So a bootstrap-owned section is answered from the environment and built-in defaults ONLY, and
10590
10590
  * the store may add exactly the keys in {@link STORE_READABLE_BOOTSTRAP_KEYS}:
10591
10591
  * the values the operator edits on System → Authentication (`auth.tokenExpiry`,
10592
10592
  * `auth.accessTokenExpiry`, `auth.trustedProxies`). Widening this list is a security decision, not a
10593
10593
  * convenience.
10594
10594
  */
10595
- /** Top-level sections whose authority is env + config.yaml (`bootstrapSchema`). */
10595
+ /** Top-level sections whose authority is the environment and built-in defaults (`bootstrapSchema`). */
10596
10596
  var BOOTSTRAP_OWNED_SECTIONS = new Set([
10597
10597
  "server",
10598
10598
  "auth",
@@ -10607,7 +10607,7 @@ var STORE_READABLE_BOOTSTRAP_KEYS = new Set([
10607
10607
  "auth.corsOrigins",
10608
10608
  "server.name"
10609
10609
  ]);
10610
- /** May the settings store answer `key`, or is it env + config.yaml only? */
10610
+ /** May the settings store answer `key`, or is it environment and defaults only? */
10611
10611
  function storeMayAnswer(key) {
10612
10612
  const dot = key.indexOf(".");
10613
10613
  const section = dot === -1 ? key : key.slice(0, dot);
@@ -10531,13 +10531,13 @@ function createAddonSettingsStore(door, addonId) {
10531
10531
  * the stale rows must still never answer: merging them back in would let a
10532
10532
  * stale DB copy stand in for a credential. The one-off ops script deletes them.
10533
10533
  *
10534
- * So a bootstrap-owned section is answered from env + config.yaml ONLY, and
10534
+ * So a bootstrap-owned section is answered from the environment and built-in defaults ONLY, and
10535
10535
  * the store may add exactly the keys in {@link STORE_READABLE_BOOTSTRAP_KEYS}:
10536
10536
  * the values the operator edits on System → Authentication (`auth.tokenExpiry`,
10537
10537
  * `auth.accessTokenExpiry`, `auth.trustedProxies`). Widening this list is a security decision, not a
10538
10538
  * convenience.
10539
10539
  */
10540
- /** Top-level sections whose authority is env + config.yaml (`bootstrapSchema`). */
10540
+ /** Top-level sections whose authority is the environment and built-in defaults (`bootstrapSchema`). */
10541
10541
  var BOOTSTRAP_OWNED_SECTIONS = new Set([
10542
10542
  "server",
10543
10543
  "auth",
@@ -10552,7 +10552,7 @@ var STORE_READABLE_BOOTSTRAP_KEYS = new Set([
10552
10552
  "auth.corsOrigins",
10553
10553
  "server.name"
10554
10554
  ]);
10555
- /** May the settings store answer `key`, or is it env + config.yaml only? */
10555
+ /** May the settings store answer `key`, or is it environment and defaults only? */
10556
10556
  function storeMayAnswer(key) {
10557
10557
  const dot = key.indexOf(".");
10558
10558
  const section = dot === -1 ? key : key.slice(0, dot);
@@ -5,7 +5,7 @@ Object.defineProperties(exports, {
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
6
  const require_dist = require("../../dist-CJoLQeEj.js");
7
7
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
8
- const require_restore_archive = require("../../restore-archive-HS5O901O.js");
8
+ const require_restore_archive = require("../../restore-archive-DfuKCYXp.js");
9
9
  let node_crypto = require("node:crypto");
10
10
  let node_fs = require("node:fs");
11
11
  node_fs = require_chunk.__toESM(node_fs);
@@ -1,6 +1,6 @@
1
1
  import { Bo as BaseAddon, Ia as storageOccupancyCapability, _i as mayWriteToLocation, ac as nodePin, bc as toNodeId, kc as EventCategory, wn as backupCapability } from "../../dist-Dgkqkron.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
- import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-DfFB1J2w.mjs";
3
+ import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-CXw4EaBA.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import * as fs$1 from "node:fs";
6
6
  import * as path$1 from "node:path";
@@ -30,7 +30,7 @@ export declare class BackupSnapshotRefusedError extends Error {
30
30
  * is excluded via `DEFAULT_BACKUP_EXCLUDES` + the node_modules rule
31
31
  * below, enforced in the walk and the tar filter alike.
32
32
  */
33
- export declare const DEFAULT_BACKUP_LOCATIONS: readonly ["config.yaml", "addons", "addons-data", "tls", "auto-update.json"];
33
+ export declare const DEFAULT_BACKUP_LOCATIONS: readonly ["addons", "addons-data", "tls", "auto-update.json"];
34
34
  /**
35
35
  * Subtrees never captured by a system backup even though they live
36
36
  * under a `DEFAULT_BACKUP_LOCATIONS` entry. Paths are dataDir-relative
@@ -88775,7 +88775,7 @@ var MESH_REAP_MS = 24 * 36e5;
88775
88775
  * state of their own (the session token lifetime).
88776
88776
  *
88777
88777
  * Sections exposed — this list is the whole of it:
88778
- * - server (port, host, dataPath — READ-ONLY, loaded from config.yaml at bootstrap;
88778
+ * - server (port, host, dataPath — READ-ONLY, set by CAMSTACK_PORT / CAMSTACK_HOST / CAMSTACK_DATA;
88779
88779
  * name = the hub's human name, `server.name`, editable — D861)
88780
88780
  * - auth (tokenExpiry = session lifetime, accessTokenExpiry, trustedProxies,
88781
88781
  * trustedNetworks, corsOrigins)
@@ -89039,7 +89039,7 @@ var SystemConfigAddon = class extends require_dist.BaseAddon {
89039
89039
  {
89040
89040
  id: "system-config-server",
89041
89041
  title: SECTION_TITLES["server"],
89042
- description: "The name of this server, and its connection settings (read-only, loaded from config.yaml at bootstrap).",
89042
+ description: "The name of this server, and its connection settings (read-only, set by the environment).",
89043
89043
  descriptionKey: "server:global.s_system-config-server.description",
89044
89044
  columns: 2,
89045
89045
  fields: [
@@ -89056,7 +89056,7 @@ var SystemConfigAddon = class extends require_dist.BaseAddon {
89056
89056
  key: "server-restart-note",
89057
89057
  label: "Restart required",
89058
89058
  labelKey: "server:global.s_system-config-server.server-restart-note.label",
89059
- content: "Port, host and data path are read-only. Change them in config.yaml and restart.",
89059
+ content: "Port, host and data path are read-only: set the environment variables CAMSTACK_PORT, CAMSTACK_HOST and CAMSTACK_DATA, then restart.",
89060
89060
  variant: "warning"
89061
89061
  },
89062
89062
  {
@@ -89064,7 +89064,7 @@ var SystemConfigAddon = class extends require_dist.BaseAddon {
89064
89064
  key: "port",
89065
89065
  label: "Port",
89066
89066
  labelKey: "server:global.s_system-config-server.port.label",
89067
- description: "Listening port",
89067
+ description: "Listening port (CAMSTACK_PORT)",
89068
89068
  descriptionKey: "server:global.s_system-config-server.port.description",
89069
89069
  disabled: true
89070
89070
  },
@@ -89073,7 +89073,7 @@ var SystemConfigAddon = class extends require_dist.BaseAddon {
89073
89073
  key: "host",
89074
89074
  label: "Host",
89075
89075
  labelKey: "server:global.s_system-config-server.host.label",
89076
- description: "Bind address",
89076
+ description: "Bind address (CAMSTACK_HOST)",
89077
89077
  descriptionKey: "server:global.s_system-config-server.host.description",
89078
89078
  disabled: true
89079
89079
  },
@@ -89082,7 +89082,7 @@ var SystemConfigAddon = class extends require_dist.BaseAddon {
89082
89082
  key: "dataPath",
89083
89083
  label: "Data Path",
89084
89084
  labelKey: "server:global.s_system-config-server.dataPath.label",
89085
- description: "Root data directory",
89085
+ description: "Root data directory (CAMSTACK_DATA)",
89086
89086
  descriptionKey: "server:global.s_system-config-server.dataPath.description",
89087
89087
  disabled: true,
89088
89088
  span: 2