20 lines
617 B
TypeScript
20 lines
617 B
TypeScript
|
import { IEnvironment } from '../types/environment';
|
||
|
import { PluginConfiguration } from '../types/plugin-config';
|
||
|
import { IPluginManifest } from './plugin';
|
||
|
|
||
|
export class PluginConfigurator {
|
||
|
private configs: Map<string, PluginConfiguration> = new Map();
|
||
|
|
||
|
constructor(private env: IEnvironment) {}
|
||
|
|
||
|
public async loadConfig(mf: IPluginManifest): Promise<PluginConfiguration> {
|
||
|
if (!this.configs.has(mf.name)) {
|
||
|
const conf = new PluginConfiguration(this.env, mf.name);
|
||
|
this.configs.set(mf.name, conf);
|
||
|
return conf;
|
||
|
}
|
||
|
|
||
|
return this.configs.get(mf.name) as PluginConfiguration;
|
||
|
}
|
||
|
}
|