npmci/ts/manager.docker/mod.classes.registrystorage.ts
2023-07-12 15:35:38 +02:00

29 lines
764 B
TypeScript

import { logger } from '../npmci.logging.js';
import * as plugins from './mod.plugins.js';
import { DockerRegistry } from './mod.classes.dockerregistry.js';
export class RegistryStorage {
objectMap = new plugins.lik.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!');
}
}