@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
31 lines • 926 B
JavaScript
// SPDX-License-Identifier: Apache-2.0
import fs from 'node:fs/promises';
import { parse } from 'yaml';
import { CacheTarget } from '../models/impl/cache-target.js';
import { CacheArtifactEnum } from '../enums/cache-artifact-enum.js';
/**
* YAML-backed provider for container image cache targets.
*
* Expected YAML shape:
*
* ```yaml
* images:
* - name: ghcr.io/my-org/my-service
* source: ghcr.io
* version: 1.2.3
* ```
*/
export class YamlImageTargetProvider {
filePath;
constructor(filePath) {
this.filePath = filePath;
}
async getRequiredTargets() {
const raw = await fs.readFile(this.filePath, 'utf8');
const parsed = parse(raw);
return (parsed.images ?? []).map((image) => {
return new CacheTarget(CacheArtifactEnum.IMAGE, image.name, image.version, image.source);
});
}
}
//# sourceMappingURL=yaml-image-target-provider.js.map