@camstack/server 1.0.1 → 1.0.2

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.
@@ -2373,7 +2373,12 @@ class AddonRegistryService {
2373
2373
  location: 'addons-data',
2374
2374
  relativePath: addonId,
2375
2375
  })
2376
- : `camstack-data/addons-data/${addonId}`;
2376
+ : // No active storage provider yet — this is an EARLY in-process builtin
2377
+ // (notably sqlite-settings, which IS the storage provider, so it loads
2378
+ // before one is active). Honor CAMSTACK_DATA here too; hardcoding the
2379
+ // relative `camstack-data` made the settings DB escape the mounted
2380
+ // data dir in container deployments.
2381
+ path.join(process.env.CAMSTACK_DATA ?? 'camstack-data', 'addons-data', addonId);
2377
2382
  const registerProvider = (capabilityName, provider) => {
2378
2383
  this.capabilityRegistry.registerProvider(capabilityName, addonId, provider);
2379
2384
  logger.info('Registered provider via context.registerProvider()', {
@@ -187,7 +187,13 @@ class MoleculerService {
187
187
  };
188
188
  const hubService = (0, kernel_1.createHubService)(hubDeps);
189
189
  this.brokerSafe.createService(hubService);
190
- const dataDir = this.config.get('dataDir') ?? 'camstack-data';
190
+ // Forked addon-runner children must root their storage (addons-data,
191
+ // the sqlite settings DB) under the SAME data path as the hub's main
192
+ // process. The configured key is `server.dataPath` (populated from the
193
+ // CAMSTACK_DATA env var); reading the non-existent `dataDir` key here
194
+ // made every child silently fall back to the relative `camstack-data`,
195
+ // so the DB escaped the mounted data dir in container deployments.
196
+ const dataDir = this.config.get('server.dataPath') ?? 'camstack-data';
191
197
  // UDS local transport: the hub hosts a LocalChildRegistry so its
192
198
  // forked addon-runners route cap calls directly over a Unix-domain
193
199
  // socket instead of through Moleculer. The broker stays available as
package/dist/launcher.js CHANGED
@@ -140,7 +140,12 @@ function parseInstallSource(value) {
140
140
  * shape validation by the call site.
141
141
  */
142
142
  function readConfigYaml(dataDir) {
143
+ // CONFIG_PATH (when set) is the authoritative location and must win — it
144
+ // is what main.ts reads/writes. Without this the launcher would miss the
145
+ // `bootstrap.*` section of a relocated config.yaml (e.g. a separate
146
+ // /config mount) and silently fall back to defaults.
143
147
  const candidates = [
148
+ ...(process.env.CONFIG_PATH ? [path.resolve(process.env.CONFIG_PATH)] : []),
144
149
  path.resolve(dataDir, '..', 'config.yaml'),
145
150
  path.resolve(dataDir, 'config.yaml'),
146
151
  path.resolve(process.cwd(), 'config.yaml'),
package/dist/main.js CHANGED
@@ -173,7 +173,13 @@ async function bootstrap() {
173
173
  // SPA fallback — set later when admin UI is resolved, used by addon route catch-all
174
174
  let spaIndexHtml = null;
175
175
  // --- Phase 1 + 2: Load config, setup storage locations, TLS ---
176
- const configPath = process.env.CONFIG_PATH ?? path.join(process.cwd(), 'camstack-data', 'config.yaml');
176
+ // Resolution order: explicit CONFIG_PATH wins (lets operators put the
177
+ // bootstrap config on its own mount, e.g. a /config volume). Otherwise
178
+ // default it UNDER the data root (CAMSTACK_DATA) so a plain data-dir mount
179
+ // also persists config.yaml. Falls back to the historical cwd-relative
180
+ // path for local/dev runs where neither env var is set.
181
+ const configPath = process.env.CONFIG_PATH ??
182
+ path.join(process.env.CAMSTACK_DATA ?? path.join(process.cwd(), 'camstack-data'), 'config.yaml');
177
183
  const bootstrapConfig = (0, boot_config_1.loadBootstrapConfig)(configPath);
178
184
  const infra = await (0, boot_config_1.setupInfra)(configPath, bootstrapConfig);
179
185
  const { dataPath, tlsOptions } = infra;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",