mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Remove Setup.
This commit is contained in:
committed by
Joachim Van Herwegen
parent
04a91858c2
commit
badbe0032b
@@ -4,7 +4,7 @@ import type { LoaderProperties } from 'componentsjs';
|
||||
import { Loader } from 'componentsjs';
|
||||
import yargs from 'yargs';
|
||||
import { ensureTrailingSlash } from '../util/PathUtil';
|
||||
import type { Setup } from './Setup';
|
||||
import type { Initializer } from './Initializer';
|
||||
|
||||
/**
|
||||
* Generic run function for starting the server from a given config
|
||||
@@ -47,8 +47,8 @@ export const runCli = function({
|
||||
// Setup from config file
|
||||
const loader = new Loader(properties);
|
||||
await loader.registerAvailableModuleResources();
|
||||
const setup: Setup = await loader
|
||||
.instantiateFromUrl('urn:solid-server:default', configPath, undefined, {
|
||||
const initializer: Initializer = await loader
|
||||
.instantiateFromUrl('urn:solid-server:default:Initializer', configPath, undefined, {
|
||||
variables: {
|
||||
'urn:solid-server:default:variable:baseUrl':
|
||||
params.baseUrl ? ensureTrailingSlash(params.baseUrl) : `http://localhost:${params.port}/`,
|
||||
@@ -59,8 +59,8 @@ export const runCli = function({
|
||||
'urn:solid-server:default:variable:podTemplateFolder':
|
||||
params.podTemplateFolder ?? path.join(__dirname, '../../templates'),
|
||||
},
|
||||
}) as Setup;
|
||||
await setup.setup();
|
||||
}) as Initializer;
|
||||
await initializer.handleSafe();
|
||||
})().catch((error): void => {
|
||||
// This is the only time we can *not* use the logger to print error messages, as dependency injection has failed.
|
||||
stderr.write(`${error}\n`);
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import type { Initializer } from './Initializer';
|
||||
|
||||
export class Setup {
|
||||
private readonly initializer: Initializer;
|
||||
|
||||
public constructor(initializer: Initializer) {
|
||||
this.initializer = initializer;
|
||||
}
|
||||
|
||||
public async setup(): Promise<void> {
|
||||
await this.initializer.handleSafe();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user