Link components to the location that created them

This commit is contained in:
Fredrik Adelöw
2020-05-14 13:16:04 +02:00
parent 920607ea8b
commit 9a2d473346
13 changed files with 89 additions and 41 deletions
+10 -8
View File
@@ -41,14 +41,16 @@ const DEFAULT_PORT = 7000;
const PORT = parseInt(process.env.PORT ?? '', 10) || DEFAULT_PORT;
function createEnv(plugin: string): PluginEnvironment {
return {
logger: getRootLogger().child({ type: 'plugin', plugin }),
database: knex({
client: 'sqlite3',
connection: ':memory:',
useNullAsDefault: true,
}),
};
const logger = getRootLogger().child({ type: 'plugin', plugin });
const database = knex({
client: 'sqlite3',
connection: ':memory:',
useNullAsDefault: true,
});
database.client.pool.on('createSuccess', (_eventId: any, resource: any) => {
resource.run('PRAGMA foreign_keys = ON', () => {});
});
return { logger, database };
}
async function main() {