diff --git a/packages/core/build/flecks.js b/packages/core/build/flecks.js index 656e4cb..efeb00a 100644 --- a/packages/core/build/flecks.js +++ b/packages/core/build/flecks.js @@ -116,6 +116,10 @@ class Flecks { for (let i = 0; i < flecks.length; i++) { this.configureFleckDefaults(flecks[i]); } + this.config = { + ...this.bootstrappedConfig, + ...this.config, + }; } /** diff --git a/packages/server/test/server/runtime-config-bootstrap.js b/packages/server/test/server/runtime-config-bootstrap.js index 70198ab..ee70925 100644 --- a/packages/server/test/server/runtime-config-bootstrap.js +++ b/packages/server/test/server/runtime-config-bootstrap.js @@ -1,14 +1,37 @@ +import {mkdir, writeFile} from 'fs/promises'; +import {join} from 'path'; + import {expect} from 'chai'; import {build, createApplication, serverActions} from './build/build'; it('propagates bootstrap config', async () => { const path = await createApplication(); + await mkdir(join(path, 'server-only', 'build'), {recursive: true}); + await writeFile(join(path, 'server-only', 'package.json'), '{}'); + const config = ` + exports.hooks = { + '@flecks/core.config': () => ({ + foo: 'bar', + }), + }; + `; + await writeFile(join(path, 'server-only', 'build', 'flecks.bootstrap.js'), config); + await writeFile( + join(path, 'build', 'flecks.yml'), + ` + '@flecks/build': {} + '@flecks/core': {} + '@flecks/server': {} + 'comm:./comm': {} + 'server-only:./server-only': {} + `, + ); await build(path, {args: ['-d']}); - const {results: [{payload: id}]} = await serverActions(path, [ - {type: 'config.get', payload: '@flecks/core.id'}, + const {results: [{payload: foo}]} = await serverActions(path, [ + {type: 'config.get', payload: 'server-only.foo'}, {type: 'exit'}, ]); - expect(id) - .to.equal('flecks'); + expect(foo) + .to.equal('bar'); });