feat: Enable dependency injection with auto-generated components

This commit is contained in:
Ruben Taelman
2020-08-25 10:24:53 +02:00
committed by Joachim Van Herwegen
parent e88e680ed7
commit db04c55196
13 changed files with 3265 additions and 1836 deletions

View File

@@ -3,7 +3,7 @@ import { AclManager } from '../authorization/AclManager';
import { ExpressHttpServer } from '../server/ExpressHttpServer';
import { ResourceStore } from '../storage/ResourceStore';
import { DATA_TYPE_BINARY } from '../util/ContentTypes';
import { RuntimeConfig } from './RuntimeConfig';
import { RuntimeConfig, RuntimeConfigData } from './RuntimeConfig';
/**
* Invokes all logic to setup a server.
@@ -28,10 +28,11 @@ export class Setup {
/**
* Set up a server at the given port and base URL.
* @param port - A port number.
* @param base - A base URL.
* @param data - Runtime config data.
*/
public async setup(): Promise<void> {
public async setup(data: RuntimeConfigData = {}): Promise<RuntimeConfig> {
this.runtimeConfig.reset(data);
// Set up acl so everything can still be done by default
// Note that this will need to be adapted to go through all the correct channels later on
const aclSetup = async(): Promise<void> => {
@@ -61,9 +62,10 @@ export class Setup {
},
);
};
await aclSetup();
this.httpServer.listen(this.runtimeConfig.port);
return this.runtimeConfig;
}
}