@celljs/core 3.9.0 → 4.1.0
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/README.md +0 -6
- package/cell.remote.yml +8 -0
- package/cell.yml +0 -3
- package/esm/common/application/application-entry.js +21 -3
- package/esm/common/application/application-entry.js.map +1 -1
- package/esm/common/application/application-host.d.ts +38 -0
- package/esm/common/application/application-host.js +17 -0
- package/esm/common/application/application-host.js.map +1 -0
- package/esm/common/application/application-protocol.js +1 -1
- package/esm/common/application/application-protocol.js.map +1 -1
- package/esm/common/application/index.d.ts +1 -0
- package/esm/common/application/index.js +1 -0
- package/esm/common/application/index.js.map +1 -1
- package/esm/common/config/config-provider.js +2 -1
- package/esm/common/config/config-provider.js.map +1 -1
- package/esm/common/config/env-config-util.d.ts +48 -0
- package/esm/common/config/env-config-util.js +185 -0
- package/esm/common/config/env-config-util.js.map +1 -0
- package/esm/common/config/index.d.ts +1 -0
- package/esm/common/config/index.js +1 -0
- package/esm/common/config/index.js.map +1 -1
- package/esm/common/container/auto-bind.js +26 -12
- package/esm/common/container/auto-bind.js.map +1 -1
- package/esm/common/el/expression-compiler.d.ts +4 -15
- package/esm/common/el/expression-compiler.js +6 -163
- package/esm/common/el/expression-compiler.js.map +1 -1
- package/esm/common/el/expression-handler.d.ts +7 -2
- package/esm/common/el/expression-handler.js +14 -53
- package/esm/common/el/expression-handler.js.map +1 -1
- package/esm/common/el/expression-util.d.ts +68 -0
- package/esm/common/el/expression-util.js +347 -0
- package/esm/common/el/expression-util.js.map +1 -0
- package/esm/common/el/index.d.ts +1 -0
- package/esm/common/el/index.js +1 -0
- package/esm/common/el/index.js.map +1 -1
- package/esm/common/logger/abstract-logger.d.ts +4 -2
- package/esm/common/logger/abstract-logger.js +11 -6
- package/esm/common/logger/abstract-logger.js.map +1 -1
- package/esm/common/logger/logger-protocol.d.ts +4 -0
- package/esm/common/logger/logger-protocol.js +2 -0
- package/esm/common/logger/logger-protocol.js.map +1 -1
- package/esm/common/logger/logger.js +7 -7
- package/esm/common/logger/logger.js.map +1 -1
- package/esm/common/test/mock-logger.d.ts +1 -0
- package/esm/common/test/mock-logger.js +3 -0
- package/esm/common/test/mock-logger.js.map +1 -1
- package/esm/common/utils/emitter.d.ts +1 -10
- package/esm/common/utils/emitter.js +0 -56
- package/esm/common/utils/emitter.js.map +1 -1
- package/esm/common/utils/mime-type-util.js +1 -1
- package/esm/common/utils/mime-type-util.js.map +1 -1
- package/esm/common/utils/mime-type.js +1 -1
- package/esm/common/utils/mime-type.js.map +1 -1
- package/esm/node/context/context.d.ts +11 -2
- package/esm/node/context/context.js +36 -12
- package/esm/node/context/context.js.map +1 -1
- package/esm/node/index.d.ts +0 -1
- package/esm/node/index.js +0 -1
- package/esm/node/index.js.map +1 -1
- package/lib/common/aop/aop.spec.d.ts +2 -0
- package/lib/common/aop/aop.spec.d.ts.map +1 -0
- package/lib/common/aop/aop.spec.js +170 -0
- package/lib/common/aop/aop.spec.js.map +1 -0
- package/lib/common/application/application-entry.d.ts.map +1 -1
- package/lib/common/application/application-entry.js +21 -3
- package/lib/common/application/application-entry.js.map +1 -1
- package/lib/common/application/application-host.d.ts +39 -0
- package/lib/common/application/application-host.d.ts.map +1 -0
- package/lib/common/application/application-host.js +20 -0
- package/lib/common/application/application-host.js.map +1 -0
- package/lib/common/application/application-protocol.js +1 -1
- package/lib/common/application/application-protocol.js.map +1 -1
- package/lib/common/application/index.d.ts +1 -0
- package/lib/common/application/index.d.ts.map +1 -1
- package/lib/common/application/index.js +1 -0
- package/lib/common/application/index.js.map +1 -1
- package/lib/common/application/lifecycle.spec.d.ts +2 -0
- package/lib/common/application/lifecycle.spec.d.ts.map +1 -0
- package/lib/common/application/lifecycle.spec.js +155 -0
- package/lib/common/application/lifecycle.spec.js.map +1 -0
- package/lib/common/config/config-provider.js +2 -1
- package/lib/common/config/config-provider.js.map +1 -1
- package/lib/common/config/env-config-util.d.ts +49 -0
- package/lib/common/config/env-config-util.d.ts.map +1 -0
- package/lib/common/config/env-config-util.js +188 -0
- package/lib/common/config/env-config-util.js.map +1 -0
- package/lib/common/config/env-config-util.spec.d.ts +2 -0
- package/lib/common/config/env-config-util.spec.d.ts.map +1 -0
- package/lib/common/config/env-config-util.spec.js +314 -0
- package/lib/common/config/env-config-util.spec.js.map +1 -0
- package/lib/common/config/index.d.ts +1 -0
- package/lib/common/config/index.d.ts.map +1 -1
- package/lib/common/config/index.js +1 -0
- package/lib/common/config/index.js.map +1 -1
- package/lib/common/container/assembly.spec.d.ts +2 -0
- package/lib/common/container/assembly.spec.d.ts.map +1 -0
- package/lib/common/container/assembly.spec.js +464 -0
- package/lib/common/container/assembly.spec.js.map +1 -0
- package/lib/common/container/auto-bind.js +26 -12
- package/lib/common/container/auto-bind.js.map +1 -1
- package/lib/common/el/expression-compiler.d.ts +4 -15
- package/lib/common/el/expression-compiler.d.ts.map +1 -1
- package/lib/common/el/expression-compiler.js +6 -163
- package/lib/common/el/expression-compiler.js.map +1 -1
- package/lib/common/el/expression-handler.d.ts +7 -2
- package/lib/common/el/expression-handler.d.ts.map +1 -1
- package/lib/common/el/expression-handler.js +14 -56
- package/lib/common/el/expression-handler.js.map +1 -1
- package/lib/common/el/expression-handler.spec.d.ts +2 -0
- package/lib/common/el/expression-handler.spec.d.ts.map +1 -0
- package/lib/common/el/expression-handler.spec.js +99 -0
- package/lib/common/el/expression-handler.spec.js.map +1 -0
- package/lib/common/el/expression-util.d.ts +69 -0
- package/lib/common/el/expression-util.d.ts.map +1 -0
- package/lib/common/el/expression-util.js +352 -0
- package/lib/common/el/expression-util.js.map +1 -0
- package/lib/common/el/expression-util.spec.d.ts +2 -0
- package/lib/common/el/expression-util.spec.d.ts.map +1 -0
- package/lib/common/el/expression-util.spec.js +45 -0
- package/lib/common/el/expression-util.spec.js.map +1 -0
- package/lib/common/el/index.d.ts +1 -0
- package/lib/common/el/index.d.ts.map +1 -1
- package/lib/common/el/index.js +1 -0
- package/lib/common/el/index.js.map +1 -1
- package/lib/common/el/value-and-el.spec.d.ts +2 -0
- package/lib/common/el/value-and-el.spec.d.ts.map +1 -0
- package/lib/common/el/value-and-el.spec.js +216 -0
- package/lib/common/el/value-and-el.spec.js.map +1 -0
- package/lib/common/logger/abstract-logger.d.ts +4 -2
- package/lib/common/logger/abstract-logger.d.ts.map +1 -1
- package/lib/common/logger/abstract-logger.js +10 -5
- package/lib/common/logger/abstract-logger.js.map +1 -1
- package/lib/common/logger/logger-protocol.d.ts +4 -0
- package/lib/common/logger/logger-protocol.d.ts.map +1 -1
- package/lib/common/logger/logger-protocol.js +3 -1
- package/lib/common/logger/logger-protocol.js.map +1 -1
- package/lib/common/logger/logger.js +7 -7
- package/lib/common/logger/logger.js.map +1 -1
- package/lib/common/logger/logger.spec.d.ts +2 -0
- package/lib/common/logger/logger.spec.d.ts.map +1 -0
- package/lib/common/logger/logger.spec.js +57 -0
- package/lib/common/logger/logger.spec.js.map +1 -0
- package/lib/common/test/mock-logger.d.ts +1 -0
- package/lib/common/test/mock-logger.d.ts.map +1 -1
- package/lib/common/test/mock-logger.js +3 -0
- package/lib/common/test/mock-logger.js.map +1 -1
- package/lib/common/utils/emitter.d.ts +1 -10
- package/lib/common/utils/emitter.d.ts.map +1 -1
- package/lib/common/utils/emitter.js +1 -58
- package/lib/common/utils/emitter.js.map +1 -1
- package/lib/common/utils/mime-type-util.js +1 -1
- package/lib/common/utils/mime-type-util.js.map +1 -1
- package/lib/common/utils/mime-type.js +1 -1
- package/lib/common/utils/mime-type.js.map +1 -1
- package/lib/common/utils/utils-behavior.spec.d.ts +2 -0
- package/lib/common/utils/utils-behavior.spec.d.ts.map +1 -0
- package/lib/common/utils/utils-behavior.spec.js +232 -0
- package/lib/common/utils/utils-behavior.spec.js.map +1 -0
- package/lib/node/context/context.d.ts +11 -2
- package/lib/node/context/context.d.ts.map +1 -1
- package/lib/node/context/context.js +36 -10
- package/lib/node/context/context.js.map +1 -1
- package/lib/node/context/context.spec.d.ts +2 -0
- package/lib/node/context/context.spec.d.ts.map +1 -0
- package/lib/node/context/context.spec.js +202 -0
- package/lib/node/context/context.spec.js.map +1 -0
- package/lib/node/index.d.ts +0 -1
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +0 -1
- package/lib/node/index.js.map +1 -1
- package/package.json +20 -41
- package/src/common/aop/aop.spec.ts +145 -0
- package/src/common/application/application-entry.ts +20 -4
- package/src/common/application/application-host.ts +46 -0
- package/src/common/application/application-protocol.ts +1 -1
- package/src/common/application/index.ts +1 -0
- package/src/common/application/lifecycle.spec.ts +148 -0
- package/src/common/config/config-provider.ts +1 -1
- package/src/common/config/env-config-util.spec.ts +341 -0
- package/src/common/config/env-config-util.ts +225 -0
- package/src/common/config/index.ts +1 -0
- package/src/common/container/assembly.spec.ts +293 -0
- package/src/common/container/auto-bind.ts +23 -10
- package/src/common/el/expression-compiler.ts +6 -166
- package/src/common/el/expression-handler.spec.ts +110 -0
- package/src/common/el/expression-handler.ts +14 -51
- package/src/common/el/expression-util.spec.ts +45 -0
- package/src/common/el/expression-util.ts +363 -0
- package/src/common/el/index.ts +2 -1
- package/src/common/el/value-and-el.spec.ts +186 -0
- package/src/common/logger/abstract-logger.ts +12 -6
- package/src/common/logger/logger-protocol.ts +5 -0
- package/src/common/logger/logger.spec.ts +61 -0
- package/src/common/logger/logger.ts +7 -7
- package/src/common/test/mock-logger.ts +3 -0
- package/src/common/utils/emitter.ts +1 -63
- package/src/common/utils/mime-type-util.ts +1 -1
- package/src/common/utils/mime-type.ts +1 -1
- package/src/common/utils/utils-behavior.spec.ts +259 -0
- package/src/node/context/context.spec.ts +219 -0
- package/src/node/context/context.ts +35 -10
- package/src/node/index.ts +0 -1
- package/cell-remote.yml +0 -3
- package/esm/node/utils/crc.d.ts +0 -1
- package/esm/node/utils/crc.js +0 -7
- package/esm/node/utils/crc.js.map +0 -1
- package/esm/node/utils/index.d.ts +0 -1
- package/esm/node/utils/index.js +0 -2
- package/esm/node/utils/index.js.map +0 -1
- package/lib/node/utils/crc.d.ts +0 -2
- package/lib/node/utils/crc.d.ts.map +0 -1
- package/lib/node/utils/crc.js +0 -10
- package/lib/node/utils/crc.js.map +0 -1
- package/lib/node/utils/index.d.ts +0 -2
- package/lib/node/utils/index.d.ts.map +0 -1
- package/lib/node/utils/index.js +0 -18
- package/lib/node/utils/index.js.map +0 -1
- package/src/node/utils/crc.ts +0 -7
- package/src/node/utils/index.ts +0 -1
|
@@ -113,7 +113,7 @@ export abstract class AbstractApplicationStateService<T extends string> implemen
|
|
|
113
113
|
|
|
114
114
|
set state(state: T) {
|
|
115
115
|
if (state !== this._state) {
|
|
116
|
-
|
|
116
|
+
// A state that was reached stays reached: late `reachedState()` calls resolve at once.
|
|
117
117
|
this._state = state;
|
|
118
118
|
if (this.deferred[state] === undefined) {
|
|
119
119
|
this.deferred[state] = new Deferred();
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { describe, it } from 'bun:test';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
import { ApplicationFactory } from './application-factory';
|
|
4
|
+
import { ApplicationLifecycle, ApplicationStateService, ApplicationState, Application } from './application-protocol';
|
|
5
|
+
import { Component } from '../annotation';
|
|
6
|
+
import { ContainerUtil } from '../container/container-util';
|
|
7
|
+
import { Scope } from '../container/scope';
|
|
8
|
+
import { Logger } from '../logger/logger-protocol';
|
|
9
|
+
import { MockLogger } from '../test/mock-logger';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 应用生命周期的约定(阶段 1.E 行为测试):ApplicationLifecycle 的调用顺序、出错时的行为、状态变化。
|
|
13
|
+
*/
|
|
14
|
+
interface Recorder { events: string[], errors: string[] }
|
|
15
|
+
|
|
16
|
+
function recordingLogger(rec: Recorder) {
|
|
17
|
+
@Component({ id: Logger, rebind: true, scope: Scope.Transient })
|
|
18
|
+
class RecordingLogger extends MockLogger {
|
|
19
|
+
override error(message: any): void {
|
|
20
|
+
rec.errors.push(String(message));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return RecordingLogger;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
describe('core 应用生命周期', () => {
|
|
27
|
+
|
|
28
|
+
it('start():先调用全部 initialize,再按顺序 await 每个 onStart;stop() 调用 onStop', async () => {
|
|
29
|
+
const rec: Recorder = { events: [], errors: [] };
|
|
30
|
+
recordingLogger(rec);
|
|
31
|
+
@Component(ApplicationLifecycle)
|
|
32
|
+
class First implements ApplicationLifecycle<Application> {
|
|
33
|
+
initialize() { rec.events.push('init:first'); }
|
|
34
|
+
async onStart() {
|
|
35
|
+
await new Promise(r => setTimeout(r, 5));
|
|
36
|
+
rec.events.push('start:first');
|
|
37
|
+
}
|
|
38
|
+
onStop() { rec.events.push('stop:first'); }
|
|
39
|
+
}
|
|
40
|
+
@Component(ApplicationLifecycle)
|
|
41
|
+
class Second implements ApplicationLifecycle<Application> {
|
|
42
|
+
initialize() { rec.events.push('init:second'); }
|
|
43
|
+
onStart() { rec.events.push('start:second'); }
|
|
44
|
+
onStop() { rec.events.push('stop:second'); }
|
|
45
|
+
}
|
|
46
|
+
const app = await ApplicationFactory.create({});
|
|
47
|
+
expect(rec.events).to.deep.equal([]);
|
|
48
|
+
await app.start();
|
|
49
|
+
const inits = rec.events.slice(0, 2);
|
|
50
|
+
expect(inits).to.have.members(['init:first', 'init:second']);
|
|
51
|
+
expect(rec.events.slice(2)).to.have.members(['start:first', 'start:second']);
|
|
52
|
+
await app.stop();
|
|
53
|
+
expect(rec.events.slice(4)).to.have.members(['stop:first', 'stop:second']);
|
|
54
|
+
expect(rec.errors).to.deep.equal([]);
|
|
55
|
+
expect([First, Second]).to.have.length(2);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('onStart 按 getAll 的顺序逐个 await(不是并发)', async () => {
|
|
59
|
+
const order: string[] = [];
|
|
60
|
+
let running = 0;
|
|
61
|
+
let maxRunning = 0;
|
|
62
|
+
for (const name of ['a', 'b', 'c']) {
|
|
63
|
+
@Component(ApplicationLifecycle)
|
|
64
|
+
class L implements ApplicationLifecycle<Application> {
|
|
65
|
+
async onStart() {
|
|
66
|
+
running++;
|
|
67
|
+
maxRunning = Math.max(maxRunning, running);
|
|
68
|
+
await new Promise(r => setTimeout(r, 2));
|
|
69
|
+
order.push(name);
|
|
70
|
+
running--;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
void L;
|
|
74
|
+
}
|
|
75
|
+
const app = await ApplicationFactory.create({});
|
|
76
|
+
await app.start();
|
|
77
|
+
expect(order).to.have.members(['a', 'b', 'c']);
|
|
78
|
+
expect(maxRunning).to.equal(1);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('initialize / onStart / onStop 抛错只记 error 日志,不影响其他生命周期,也不让 start() 失败', async () => {
|
|
82
|
+
const rec: Recorder = { events: [], errors: [] };
|
|
83
|
+
recordingLogger(rec);
|
|
84
|
+
@Component(ApplicationLifecycle)
|
|
85
|
+
class Broken implements ApplicationLifecycle<Application> {
|
|
86
|
+
initialize() { throw new Error('init boom'); }
|
|
87
|
+
onStart() { throw new Error('start boom'); }
|
|
88
|
+
onStop() { throw new Error('stop boom'); }
|
|
89
|
+
}
|
|
90
|
+
@Component(ApplicationLifecycle)
|
|
91
|
+
class Healthy implements ApplicationLifecycle<Application> {
|
|
92
|
+
initialize() { rec.events.push('init'); }
|
|
93
|
+
onStart() { rec.events.push('start'); }
|
|
94
|
+
onStop() { rec.events.push('stop'); }
|
|
95
|
+
}
|
|
96
|
+
const app = await ApplicationFactory.create({});
|
|
97
|
+
await app.start();
|
|
98
|
+
await app.stop();
|
|
99
|
+
expect(rec.events).to.deep.equal(['init', 'start', 'stop']);
|
|
100
|
+
expect(rec.errors).to.deep.equal(['Could not initialize lifecycle', 'Could not start lifecycle', 'Could not stop lifecycle']);
|
|
101
|
+
expect([Broken, Healthy]).to.have.length(2);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('没有任何 ApplicationLifecycle 时 start / stop 正常', async () => {
|
|
105
|
+
const app = await ApplicationFactory.create({});
|
|
106
|
+
await app.start();
|
|
107
|
+
await app.stop();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('状态:init → started → ready,stop 之后是 stoped;reachedState 与 onStateChanged', async () => {
|
|
111
|
+
const app = await ApplicationFactory.create({});
|
|
112
|
+
const states = ContainerUtil.get<ApplicationStateService<ApplicationState>>(ApplicationStateService);
|
|
113
|
+
expect(states.state).to.equal('init');
|
|
114
|
+
const seen: string[] = [];
|
|
115
|
+
states.onStateChanged(s => seen.push(s));
|
|
116
|
+
const ready = states.reachedState('ready');
|
|
117
|
+
const readyOrStopped = states.reachedAnyState('ready', 'stoped');
|
|
118
|
+
await app.start();
|
|
119
|
+
await ready;
|
|
120
|
+
await readyOrStopped;
|
|
121
|
+
expect(states.state).to.equal('ready');
|
|
122
|
+
await app.stop();
|
|
123
|
+
expect(states.state).to.equal('stoped');
|
|
124
|
+
expect(seen).to.deep.equal(['started', 'ready', 'stoped']);
|
|
125
|
+
// 当前状态再等会立刻 resolve
|
|
126
|
+
await states.reachedState('stoped');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('离开一个状态之后,再 reachedState(那个状态) 立即 resolve(F7)', async () => {
|
|
130
|
+
const app = await ApplicationFactory.create({});
|
|
131
|
+
const states = ContainerUtil.get<ApplicationStateService<ApplicationState>>(ApplicationStateService);
|
|
132
|
+
await app.start();
|
|
133
|
+
const race = (p: Promise<void>) => Promise.race([p.then(() => 'resolved'), new Promise(r => setTimeout(() => r('pending'), 20))]);
|
|
134
|
+
expect(await race(states.reachedState('ready'))).to.equal('resolved');
|
|
135
|
+
expect(await race(states.reachedState('started'))).to.equal('resolved');
|
|
136
|
+
expect(await race(states.reachedState('stoped'))).to.equal('pending');
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('同一个状态重复设置不会重复通知', async () => {
|
|
140
|
+
await ApplicationFactory.create({});
|
|
141
|
+
const states = ContainerUtil.get<ApplicationStateService<ApplicationState>>(ApplicationStateService);
|
|
142
|
+
const seen: string[] = [];
|
|
143
|
+
states.onStateChanged(s => seen.push(s));
|
|
144
|
+
states.state = 'started';
|
|
145
|
+
states.state = 'started';
|
|
146
|
+
expect(seen).to.deep.equal(['started']);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
@@ -9,7 +9,7 @@ export class ConfigProviderImpl implements ConfigProvider {
|
|
|
9
9
|
protected readonly expressionHandler: ExpressionHandler;
|
|
10
10
|
|
|
11
11
|
get<T>(key: string, defaultValue?: T): T {
|
|
12
|
-
return this.expressionHandler.handle(`\${${key}}`)
|
|
12
|
+
return this.expressionHandler.handle(`\${${key}}`) ?? defaultValue;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { describe, it } from 'bun:test';
|
|
2
|
+
import * as chai from 'chai';
|
|
3
|
+
import { EnvConfigUtil } from './env-config-util';
|
|
4
|
+
const expect = chai.expect;
|
|
5
|
+
|
|
6
|
+
describe('EnvConfigUtil', () => {
|
|
7
|
+
const config = () => ({
|
|
8
|
+
cell: {
|
|
9
|
+
server: { path: '/', port: 3000, endpoint: 'http://localhost:${cell.server.port}' },
|
|
10
|
+
'serve-static': { enabled: true },
|
|
11
|
+
typeorm: { ormConfig: [{ type: 'sqlite', database: 'db.sql', logging: false }] },
|
|
12
|
+
cors: null,
|
|
13
|
+
},
|
|
14
|
+
accounts: { title: 'Accounts', providers: ['github'] },
|
|
15
|
+
mode: ['production'],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('sets keys under cell, matching case, underscores and dashes loosely', () => {
|
|
19
|
+
const target = config();
|
|
20
|
+
const result = EnvConfigUtil.apply(
|
|
21
|
+
target,
|
|
22
|
+
{
|
|
23
|
+
CELL_BACKEND__SERVER__PORT: '8080',
|
|
24
|
+
CELL_BACKEND__SERVE_STATIC__ENABLED: 'FALSE',
|
|
25
|
+
CELL_BACKEND__TYPEORM__ORM_CONFIG__0__DATABASE: '/data/db.sql',
|
|
26
|
+
CELL_BACKEND__TYPEORM__ORM_CONFIG__0__LOGGING: 'true',
|
|
27
|
+
PATH: '/usr/bin',
|
|
28
|
+
},
|
|
29
|
+
'backend',
|
|
30
|
+
);
|
|
31
|
+
expect(result.problems).to.deep.equal([]);
|
|
32
|
+
expect(result.applied).to.deep.equal([
|
|
33
|
+
{ variable: 'CELL_BACKEND__SERVER__PORT', path: 'cell.server.port' },
|
|
34
|
+
{ variable: 'CELL_BACKEND__SERVE_STATIC__ENABLED', path: 'cell.serve-static.enabled' },
|
|
35
|
+
{ variable: 'CELL_BACKEND__TYPEORM__ORM_CONFIG__0__DATABASE', path: 'cell.typeorm.ormConfig.0.database' },
|
|
36
|
+
{ variable: 'CELL_BACKEND__TYPEORM__ORM_CONFIG__0__LOGGING', path: 'cell.typeorm.ormConfig.0.logging' },
|
|
37
|
+
]);
|
|
38
|
+
expect(target.cell.server.port).to.equal(8080);
|
|
39
|
+
expect(target.cell['serve-static'].enabled).to.equal(false);
|
|
40
|
+
expect(target.cell.typeorm.ormConfig[0]).to.deep.equal({ type: 'sqlite', database: '/data/db.sql', logging: true });
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('keeps expressions of other keys for later evaluation', () => {
|
|
44
|
+
const target = config();
|
|
45
|
+
EnvConfigUtil.apply(target, { CELL_BACKEND__SERVER__PORT: '8080' }, 'backend');
|
|
46
|
+
expect(target.cell.server.endpoint).to.equal('http://localhost:${cell.server.port}');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('reaches top-level keys outside cell from the root', () => {
|
|
50
|
+
const target = config();
|
|
51
|
+
const { applied } = EnvConfigUtil.apply(target, { CELL_BACKEND__ACCOUNTS__TITLE: 'Team', CELL_BACKEND__CELL__SERVER__PATH: '/api' }, 'backend');
|
|
52
|
+
expect(applied.map(a => a.path)).to.deep.equal(['accounts.title', 'cell.server.path']);
|
|
53
|
+
expect(target.accounts.title).to.equal('Team');
|
|
54
|
+
expect(target.cell.server.path).to.equal('/api');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('parses objects and arrays as JSON and leaves strings as they are', () => {
|
|
58
|
+
const target = config();
|
|
59
|
+
const result = EnvConfigUtil.apply(
|
|
60
|
+
target,
|
|
61
|
+
{
|
|
62
|
+
CELL_BACKEND__ACCOUNTS__PROVIDERS: '["github","gitlab"]',
|
|
63
|
+
CELL_BACKEND__CORS: '{"origin":"*"}',
|
|
64
|
+
CELL_BACKEND__SERVER__ENDPOINT: '8080',
|
|
65
|
+
},
|
|
66
|
+
'backend',
|
|
67
|
+
);
|
|
68
|
+
expect(result.problems).to.deep.equal([]);
|
|
69
|
+
expect(target.accounts.providers).to.deep.equal(['github', 'gitlab']);
|
|
70
|
+
expect(target.cell.cors).to.deep.equal({ origin: '*' });
|
|
71
|
+
expect(target.cell.server.endpoint).to.equal('8080');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('reports variables that match no key or do not fit its type, and changes nothing for them', () => {
|
|
75
|
+
const target = config();
|
|
76
|
+
const { applied, problems } = EnvConfigUtil.apply(
|
|
77
|
+
target,
|
|
78
|
+
{
|
|
79
|
+
CELL_BACKEND__SERVER__PROT: '1',
|
|
80
|
+
CELL_BACKEND__SERVR__PORT: '1',
|
|
81
|
+
CELL_BACKEND__SERVER__PORT: 'abc',
|
|
82
|
+
CELL_BACKEND__SERVE_STATIC__ENABLED: 'yes',
|
|
83
|
+
CELL_BACKEND__ACCOUNTS__PROVIDERS: 'github',
|
|
84
|
+
CELL_BACKEND__TYPEORM__ORM_CONFIG__3__TYPE: 'mysql',
|
|
85
|
+
CELL_BACKEND__SERVER__PORT__X: '1',
|
|
86
|
+
CELL_BACKEND__SERVER____PORT: '1',
|
|
87
|
+
},
|
|
88
|
+
'backend',
|
|
89
|
+
);
|
|
90
|
+
expect(applied).to.deep.equal([]);
|
|
91
|
+
expect(target).to.deep.equal(config());
|
|
92
|
+
const messages = Object.fromEntries(problems.map(p => [p.variable, p.message]));
|
|
93
|
+
expect(messages.CELL_BACKEND__SERVER__PROT).to.equal(
|
|
94
|
+
"no key 'PROT' under cell.server (keys: path, port, endpoint). Only keys present in cell.yml can be overridden.",
|
|
95
|
+
);
|
|
96
|
+
expect(messages.CELL_BACKEND__SERVR__PORT).to.equal(
|
|
97
|
+
"no key 'SERVR' at the top level (keys: cell, accounts, mode) or under cell (keys: server, serve-static, typeorm, cors). Only keys present in cell.yml can be overridden.",
|
|
98
|
+
);
|
|
99
|
+
expect(messages.CELL_BACKEND__SERVER__PORT).to.equal("cell.server.port is a number, got 'abc'. Use a decimal number such as 8080, -1 or 0.5.");
|
|
100
|
+
expect(messages.CELL_BACKEND__SERVE_STATIC__ENABLED).to.equal("cell.serve-static.enabled is a boolean, got 'yes'. Use true or false.");
|
|
101
|
+
expect(messages.CELL_BACKEND__ACCOUNTS__PROVIDERS).to.contain('accounts.providers is an array; pass it as JSON');
|
|
102
|
+
expect(messages.CELL_BACKEND__TYPEORM__ORM_CONFIG__3__TYPE).to.contain('(indexes 0-0)');
|
|
103
|
+
expect(messages.CELL_BACKEND__SERVER__PORT__X).to.equal("cell.server.port is not an object, so it has no key 'X'.");
|
|
104
|
+
expect(messages.CELL_BACKEND__SERVER____PORT).to.contain('empty segment');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('applies the backend variables of process.env and warns about the ones that do not apply', () => {
|
|
108
|
+
const variables = { CELL_BACKEND__SERVER__PORT: '8080', CELL_BACKEND__SERVER__PROT: '1', CELL_FRONTEND__SERVER__PATH: '/ui' };
|
|
109
|
+
const warn = console.warn;
|
|
110
|
+
const warnings: string[] = [];
|
|
111
|
+
console.warn = (message: string) => warnings.push(message);
|
|
112
|
+
Object.assign(process.env, variables);
|
|
113
|
+
try {
|
|
114
|
+
const target = config();
|
|
115
|
+
const result = EnvConfigUtil.applyProcessEnv(target);
|
|
116
|
+
expect(result.applied).to.deep.equal([{ variable: 'CELL_BACKEND__SERVER__PORT', path: 'cell.server.port' }]);
|
|
117
|
+
expect(target.cell.server).to.deep.include({ port: 8080, path: '/' });
|
|
118
|
+
expect(warnings).to.deep.equal([
|
|
119
|
+
"[cell] CELL_BACKEND__SERVER__PROT is ignored: no key 'PROT' under cell.server (keys: path, port, endpoint). Only keys present in cell.yml can be overridden.",
|
|
120
|
+
]);
|
|
121
|
+
} finally {
|
|
122
|
+
console.warn = warn;
|
|
123
|
+
for (const name of Object.keys(variables)) {
|
|
124
|
+
delete process.env[name];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('takes finite numbers in JSON syntax only', () => {
|
|
130
|
+
const port = (value: string) => {
|
|
131
|
+
const target = config();
|
|
132
|
+
const { applied, problems } = EnvConfigUtil.apply(target, { CELL_BACKEND__SERVER__PORT: value }, 'backend');
|
|
133
|
+
return applied.length === 1 ? target.cell.server.port : problems[0].message;
|
|
134
|
+
};
|
|
135
|
+
for (const [value, expected] of [['8080', 8080], ['0', 0], ['-1', -1], ['0.5', 0.5], ['1e3', 1000], ['-2.5E-1', -0.25]] as const) {
|
|
136
|
+
expect(port(value), value).to.equal(expected);
|
|
137
|
+
}
|
|
138
|
+
for (const value of ['Infinity', '-Infinity', 'NaN', '1e999', '0x10', '0b1', '1_000', '+1', '08080', '.5', '5.', '', ' 8080', '8080 ']) {
|
|
139
|
+
expect(port(value), JSON.stringify(value)).to.equal(`cell.server.port is a number, got '${value}'. Use a decimal number such as 8080, -1 or 0.5.`);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('follows null in cell.yml with JSON when the value is JSON, else text', () => {
|
|
144
|
+
const cors = (value: string) => {
|
|
145
|
+
const target = config();
|
|
146
|
+
EnvConfigUtil.apply(target, { CELL_BACKEND__CORS: value }, 'backend');
|
|
147
|
+
return target.cell.cors;
|
|
148
|
+
};
|
|
149
|
+
expect(cors('null')).to.equal(null);
|
|
150
|
+
expect(cors('5')).to.equal(5);
|
|
151
|
+
expect(cors('false')).to.equal(false);
|
|
152
|
+
expect(cors('"5"')).to.equal('5');
|
|
153
|
+
expect(cors('[1]')).to.deep.equal([1]);
|
|
154
|
+
expect(cors('*')).to.equal('*');
|
|
155
|
+
expect(cors('')).to.equal('');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('keeps a value that is one ${...} expression for evaluation, whatever the type of the key', () => {
|
|
159
|
+
const target = config();
|
|
160
|
+
const { applied, problems } = EnvConfigUtil.apply(
|
|
161
|
+
target,
|
|
162
|
+
{
|
|
163
|
+
CELL_BACKEND__SERVER__PORT: '${env.PORT ?: 3000}',
|
|
164
|
+
CELL_BACKEND__SERVE_STATIC__ENABLED: '${env.STATIC == "on"}',
|
|
165
|
+
CELL_BACKEND__ACCOUNTS__PROVIDERS: '${cell.providers}',
|
|
166
|
+
CELL_BACKEND__SERVER__PATH: '/${env.BASE}',
|
|
167
|
+
},
|
|
168
|
+
'backend',
|
|
169
|
+
);
|
|
170
|
+
expect(problems).to.deep.equal([]);
|
|
171
|
+
expect(applied).to.have.length(4);
|
|
172
|
+
expect(target.cell.server.port).to.equal('${env.PORT ?: 3000}');
|
|
173
|
+
expect(target.cell['serve-static'].enabled).to.equal('${env.STATIC == "on"}');
|
|
174
|
+
expect(target.accounts.providers).to.equal('${cell.providers}');
|
|
175
|
+
expect(target.cell.server.path).to.equal('/${env.BASE}');
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('rejects text around an expression where the key needs a number, boolean, object or array', () => {
|
|
179
|
+
const { applied, problems } = EnvConfigUtil.apply(
|
|
180
|
+
config(),
|
|
181
|
+
{ CELL_BACKEND__SERVER__PORT: '80${env.X}', CELL_BACKEND__SERVE_STATIC__ENABLED: '${a} ${b}', CELL_BACKEND__ACCOUNTS__PROVIDERS: 'x${a}' },
|
|
182
|
+
'backend',
|
|
183
|
+
);
|
|
184
|
+
expect(applied).to.deep.equal([]);
|
|
185
|
+
expect(problems.map(p => p.variable)).to.deep.equal([
|
|
186
|
+
'CELL_BACKEND__ACCOUNTS__PROVIDERS',
|
|
187
|
+
'CELL_BACKEND__SERVER__PORT',
|
|
188
|
+
'CELL_BACKEND__SERVE_STATIC__ENABLED',
|
|
189
|
+
]);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it('takes true and false in any case for booleans and names the value it rejects', () => {
|
|
193
|
+
const enabled = (value: string) => {
|
|
194
|
+
const target = config();
|
|
195
|
+
const { problems } = EnvConfigUtil.apply(target, { CELL_BACKEND__SERVE_STATIC__ENABLED: value }, 'backend');
|
|
196
|
+
return problems.length > 0 ? problems[0].message : target.cell['serve-static'].enabled;
|
|
197
|
+
};
|
|
198
|
+
expect(enabled('FALSE')).to.equal(false);
|
|
199
|
+
expect(enabled('True')).to.equal(true);
|
|
200
|
+
for (const value of ['yes', '1', '0', '', ' true']) {
|
|
201
|
+
expect(enabled(value)).to.equal(`cell.serve-static.enabled is a boolean, got '${value}'. Use true or false.`);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('rejects integers that a number cannot hold exactly', () => {
|
|
206
|
+
const port = (value: string) => {
|
|
207
|
+
const target = config();
|
|
208
|
+
const { problems } = EnvConfigUtil.apply(target, { CELL_BACKEND__SERVER__PORT: value }, 'backend');
|
|
209
|
+
return problems.length > 0 ? problems[0].message : target.cell.server.port;
|
|
210
|
+
};
|
|
211
|
+
expect(port('9007199254740991')).to.equal(9007199254740991);
|
|
212
|
+
expect(port('-9007199254740991')).to.equal(-9007199254740991);
|
|
213
|
+
expect(port('1.5e300')).to.equal(1.5e300);
|
|
214
|
+
expect(port('9007199254740993')).to.equal(
|
|
215
|
+
"cell.server.port is a number, got '9007199254740993', which is too large to keep exactly. Use a string in cell.yml for such values.",
|
|
216
|
+
);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it('addresses array items by canonical index only', () => {
|
|
220
|
+
const target = config();
|
|
221
|
+
const { applied, problems } = EnvConfigUtil.apply(
|
|
222
|
+
target,
|
|
223
|
+
{
|
|
224
|
+
CELL_BACKEND__ACCOUNTS__PROVIDERS__00: 'gitlab',
|
|
225
|
+
CELL_BACKEND__TYPEORM__ORM_CONFIG__00__TYPE: 'mysql',
|
|
226
|
+
CELL_BACKEND__TYPEORM__ORM_CONFIG__0__TYPE: 'postgres',
|
|
227
|
+
},
|
|
228
|
+
'backend',
|
|
229
|
+
);
|
|
230
|
+
expect(applied.map(a => a.path)).to.deep.equal(['cell.typeorm.ormConfig.0.type']);
|
|
231
|
+
expect(problems.map(p => p.variable)).to.deep.equal(['CELL_BACKEND__ACCOUNTS__PROVIDERS__00', 'CELL_BACKEND__TYPEORM__ORM_CONFIG__00__TYPE']);
|
|
232
|
+
expect(problems[0].message).to.equal("no key '00' under accounts.providers (indexes 0-0). Only keys present in cell.yml can be overridden.");
|
|
233
|
+
// '00' must not become a property of the array next to item 0.
|
|
234
|
+
expect(Object.keys(target.accounts.providers)).to.deep.equal(['0']);
|
|
235
|
+
expect(target.cell.typeorm.ormConfig[0].type).to.equal('postgres');
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
describe('keys set by more than one variable', () => {
|
|
239
|
+
const conflict = (env: Record<string, string>) => {
|
|
240
|
+
const target = config();
|
|
241
|
+
return { target, ...EnvConfigUtil.apply(target, env, 'backend') };
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
it('applies none of the variables that set the same key, however they spell it', () => {
|
|
245
|
+
const { target, applied, problems } = conflict({
|
|
246
|
+
CELL_BACKEND__SERVER__PORT: '1',
|
|
247
|
+
CELL_BACKEND__CELL__SERVER__PORT: '2',
|
|
248
|
+
CELL_BACKEND__SERVER__P_ORT: '3',
|
|
249
|
+
CELL_BACKEND__SERVER__PATH: '/api',
|
|
250
|
+
});
|
|
251
|
+
expect(applied).to.deep.equal([{ variable: 'CELL_BACKEND__SERVER__PATH', path: 'cell.server.path' }]);
|
|
252
|
+
expect(target.cell.server.port).to.equal(3000);
|
|
253
|
+
expect(problems.map(p => p.variable)).to.deep.equal(['CELL_BACKEND__CELL__SERVER__PORT', 'CELL_BACKEND__SERVER__PORT', 'CELL_BACKEND__SERVER__P_ORT']);
|
|
254
|
+
expect(problems[1].message).to.equal(
|
|
255
|
+
'sets cell.server.port, which CELL_BACKEND__CELL__SERVER__PORT (cell.server.port), CELL_BACKEND__SERVER__P_ORT (cell.server.port) also set. Set each key with one variable; to change items of an object or array you replace, write them into its JSON.',
|
|
256
|
+
);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('applies neither a key nor a key inside it, in either order of the names', () => {
|
|
260
|
+
const pairs = [
|
|
261
|
+
// The whole array sorts first, then the item.
|
|
262
|
+
['CELL_BACKEND__TYPEORM__ORM_CONFIG', 'CELL_BACKEND__TYPEORM__ORM_CONFIG__0__DATABASE'],
|
|
263
|
+
// The item sorts first: applied in order, the array would have wiped it out.
|
|
264
|
+
['CELL_BACKEND__TYPEORM__ORM_CONFIG', 'CELL_BACKEND__CELL__TYPEORM__ORM_CONFIG__0__DATABASE'],
|
|
265
|
+
['CELL_BACKEND__CELL__TYPEORM__ORM_CONFIG', 'CELL_BACKEND__TYPEORM__ORM_CONFIG__0__DATABASE'],
|
|
266
|
+
];
|
|
267
|
+
for (const [whole, item] of pairs) {
|
|
268
|
+
const { target, applied, problems } = conflict({ [whole]: '[{"type":"mysql"}]', [item]: 'x.sql' });
|
|
269
|
+
expect(applied, `${whole} + ${item}`).to.deep.equal([]);
|
|
270
|
+
expect(problems.map(p => p.variable).sort()).to.deep.equal([item, whole].sort());
|
|
271
|
+
expect(problems.find(p => p.variable === item)!.message).to.contain(`which ${whole} (cell.typeorm.ormConfig) also sets`);
|
|
272
|
+
expect(target.cell.typeorm.ormConfig).to.deep.equal(config().cell.typeorm.ormConfig);
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
it('lets variables of different keys under the same object apply', () => {
|
|
277
|
+
const { applied, problems } = conflict({ CELL_BACKEND__TYPEORM__ORM_CONFIG__0__TYPE: 'mysql', CELL_BACKEND__TYPEORM__ORM_CONFIG__0__DATABASE: 'x' });
|
|
278
|
+
expect(problems).to.deep.equal([]);
|
|
279
|
+
expect(applied).to.have.length(2);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it('does not depend on the order of the variables in the environment', () => {
|
|
283
|
+
const names = ['CELL_BACKEND__TYPEORM__ORM_CONFIG__0__DATABASE', 'CELL_BACKEND__CELL__TYPEORM__ORM_CONFIG', 'CELL_BACKEND__SERVER__PORT'];
|
|
284
|
+
const run = (order: string[]) => {
|
|
285
|
+
const target = config();
|
|
286
|
+
const env = Object.fromEntries(order.map(name => [name, name.endsWith('ORM_CONFIG') ? '[]' : '1']));
|
|
287
|
+
return JSON.stringify({ result: EnvConfigUtil.apply(target, env, 'backend'), target });
|
|
288
|
+
};
|
|
289
|
+
expect(run([...names].reverse())).to.equal(run(names));
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
describe('top-level keys with the same name as keys under cell', () => {
|
|
294
|
+
const shadowed = () => ({ cell: { server: { port: 3000 }, accounts: { title: 'Inner' } }, server: { x: 1 }, accounts: { title: 'Outer', team: 't' } });
|
|
295
|
+
|
|
296
|
+
it('looks up the first key at the top level, then under cell', () => {
|
|
297
|
+
const target = shadowed();
|
|
298
|
+
const { applied, problems } = EnvConfigUtil.apply(
|
|
299
|
+
target,
|
|
300
|
+
{ CELL_BACKEND__SERVER__X: '5', CELL_BACKEND__ACCOUNTS__TEAM: 'u', CELL_BACKEND__ACCOUNTS__TITLE: 'Top' },
|
|
301
|
+
'backend',
|
|
302
|
+
);
|
|
303
|
+
expect(problems).to.deep.equal([]);
|
|
304
|
+
expect(applied).to.deep.equal([
|
|
305
|
+
{ variable: 'CELL_BACKEND__ACCOUNTS__TEAM', path: 'accounts.team', shadows: 'cell.accounts' },
|
|
306
|
+
{ variable: 'CELL_BACKEND__ACCOUNTS__TITLE', path: 'accounts.title', shadows: 'cell.accounts' },
|
|
307
|
+
{ variable: 'CELL_BACKEND__SERVER__X', path: 'server.x', shadows: 'cell.server' },
|
|
308
|
+
]);
|
|
309
|
+
expect(target).to.deep.equal({ cell: { server: { port: 3000 }, accounts: { title: 'Inner' } }, server: { x: 5 }, accounts: { title: 'Top', team: 'u' } });
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it('reaches the keys under cell with CELL__, and reports a key missing from the top-level one', () => {
|
|
313
|
+
const target = shadowed();
|
|
314
|
+
const { applied, problems } = EnvConfigUtil.apply(
|
|
315
|
+
target,
|
|
316
|
+
{ CELL_BACKEND__CELL__ACCOUNTS__TITLE: 'In', CELL_BACKEND__CELL__SERVER__PORT: '8080', CELL_BACKEND__SERVER__PORT: '1' },
|
|
317
|
+
'backend',
|
|
318
|
+
);
|
|
319
|
+
expect(applied).to.deep.equal([
|
|
320
|
+
{ variable: 'CELL_BACKEND__CELL__ACCOUNTS__TITLE', path: 'cell.accounts.title' },
|
|
321
|
+
{ variable: 'CELL_BACKEND__CELL__SERVER__PORT', path: 'cell.server.port' },
|
|
322
|
+
]);
|
|
323
|
+
expect(target.cell).to.deep.equal({ server: { port: 8080 }, accounts: { title: 'In' } });
|
|
324
|
+
expect(problems).to.deep.equal([
|
|
325
|
+
{ variable: 'CELL_BACKEND__SERVER__PORT', message: "no key 'PORT' under server (keys: x). Only keys present in cell.yml can be overridden." },
|
|
326
|
+
]);
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
it('falls back to cell when the top level has no such key', () => {
|
|
330
|
+
const { applied } = EnvConfigUtil.apply(config(), { CELL_BACKEND__SERVER__PORT: '1' }, 'backend');
|
|
331
|
+
expect(applied).to.deep.equal([{ variable: 'CELL_BACKEND__SERVER__PORT', path: 'cell.server.port' }]);
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it('only reads the variables of the given target', () => {
|
|
336
|
+
const target = config();
|
|
337
|
+
const result = EnvConfigUtil.apply(target, { CELL_FRONTEND__SERVER__PORT: '1', CELL_BACKEND__SERVER__PORT: '2' }, 'frontend');
|
|
338
|
+
expect(result.applied).to.deep.equal([{ variable: 'CELL_FRONTEND__SERVER__PORT', path: 'cell.server.port' }]);
|
|
339
|
+
expect(target.cell.server.port).to.equal(1);
|
|
340
|
+
});
|
|
341
|
+
});
|