npmci/ts/manager.docker/mod.classes.registrystorage.ts
2021-10-19 03:09:50 +02:00

30 lines
787 B
TypeScript

import { logger } from '../npmci.logging';
import * as plugins from './mod.plugins';
import { ObjectMap } from '@pushrocks/lik';
import { DockerRegistry } from './mod.classes.dockerregistry';
export class RegistryStorage {
objectMap = new ObjectMap<DockerRegistry>();
constructor() {
// Nothing here
}
addRegistry(registryArg: DockerRegistry) {
this.objectMap.add(registryArg);
}
getRegistryByUrl(registryUrlArg: string) {
return this.objectMap.findSync((registryArg) => {
return registryArg.registryUrl === registryUrlArg;
});
}
async loginAll() {
await this.objectMap.forEach(async (registryArg) => {
await registryArg.login();
});
logger.log('success', 'logged in successfully into all available DockerRegistries!');
}
}