mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-19 07:48:08 +00:00
Make the config module a singleton
Change-type: patch Co-authored-by: Pagan Gazzard <page@balena.io> Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
import * as fs from 'fs';
|
||||
import * as db from '../../src/db';
|
||||
import * as config from '../../src/config';
|
||||
|
||||
export = async function () {
|
||||
await db.initialized;
|
||||
await config.initialized;
|
||||
|
||||
await db.transaction(async (trx) => {
|
||||
const result = await trx.raw(`
|
||||
SELECT name, sql
|
||||
@ -51,11 +54,15 @@ export = async function () {
|
||||
'./test/data/config-apibinder-offline.json',
|
||||
fs.readFileSync('./test/data/testconfig-apibinder-offline.json'),
|
||||
);
|
||||
return fs.writeFileSync(
|
||||
fs.writeFileSync(
|
||||
'./test/data/config-apibinder-offline2.json',
|
||||
fs.readFileSync('./test/data/testconfig-apibinder-offline2.json'),
|
||||
);
|
||||
} catch (e) {
|
||||
/* ignore /*/
|
||||
}
|
||||
|
||||
// @ts-expect-error using private properties
|
||||
config.configJsonBackend.cache = await config.configJsonBackend.read();
|
||||
await config.generateRequiredFields();
|
||||
};
|
||||
|
Reference in New Issue
Block a user