export function applyYamlFromDir()

in lib/utils/yaml-utils.ts [14:35]


export function applyYamlFromDir(dir: string, cluster: eks.Cluster, namespaceManifest: KubernetesManifest): void {
    fs.readdir(dir, 'utf8', (err, files) => {
        if (files != undefined) {
            files.forEach((file) => {
                if (file.split('.').pop() == 'yaml') {
                    fs.readFile(dir + file, 'utf8', (err, data) => {
                        if (data != undefined) {
                            let i = 0;
                            yaml.loadAll(data, function(item) {
                                const resources = cluster.addManifest(file.substring(0, file.length - 5) + i, <Record<string, any>[]>item);
                                resources.node.addDependency(namespaceManifest);
                                i++;
                            });
                        }
                    });
                }
            });
        } else {
            console.log(`${dir} is empty`);
        }
    });
}