Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function configureContainer() {
const opts = {
resolutionMode: ResolutionMode.CLASSIC
};
// @todo create a bootstrap sequence
const dataFolder = process.env.DATA_FOLDER || path.join(process.env.HOME, '.media_speed');
const imagesFolder = path.join(dataFolder, 'cache', 'images');
const transcodingTempFolder = path.join(dataFolder, 'cache', 'transcoding_temp');
await fsExtra.ensureDir(dataFolder);
await fsExtra.ensureDir(imagesFolder);
await fsExtra.ensureDir(transcodingTempFolder);
const configFile = path.join(dataFolder, 'config.json');
if (!fsExtra.existsSync(configFile)) {
await fsExtra.copy(`${__dirname}/../../config.json.dist`, path.join(dataFolder, 'config.json'));
}
registerAll(): void {
this.container.loadModules([
[`${__dirname}/business/**/*.js`, Lifetime.TRANSIENT],
[`${__dirname}/services/**/*.js`, Lifetime.SINGLETON],
[`${__dirname}/adapters/**/*.js`, Lifetime.TRANSIENT]
], {
formatName: 'camelCase',
cwd: '.',
registrationOptions: {
resolutionMode: ResolutionMode.CLASSIC
}
});
debug('app:dependency-resolver')(this.container.registrations);
}
}