fix cases where configurations are empty
This commit is contained in:
parent
d66326b41d
commit
3882dd4f5a
1 changed files with 8 additions and 0 deletions
|
@ -15,6 +15,10 @@ export async function servicesFromConfig() {
|
||||||
const fileContents = await fs.readFile(servicesYaml, "utf8");
|
const fileContents = await fs.readFile(servicesYaml, "utf8");
|
||||||
const services = yaml.load(fileContents);
|
const services = yaml.load(fileContents);
|
||||||
|
|
||||||
|
if (!services) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
// map easy to write YAML objects into easy to consume JS arrays
|
// map easy to write YAML objects into easy to consume JS arrays
|
||||||
const servicesArray = services.map((servicesGroup) => ({
|
const servicesArray = services.map((servicesGroup) => ({
|
||||||
name: Object.keys(servicesGroup)[0],
|
name: Object.keys(servicesGroup)[0],
|
||||||
|
@ -34,6 +38,10 @@ export async function servicesFromDocker() {
|
||||||
const dockerFileContents = await fs.readFile(dockerYaml, "utf8");
|
const dockerFileContents = await fs.readFile(dockerYaml, "utf8");
|
||||||
const servers = yaml.load(dockerFileContents);
|
const servers = yaml.load(dockerFileContents);
|
||||||
|
|
||||||
|
if (!servers) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const serviceServers = await Promise.all(
|
const serviceServers = await Promise.all(
|
||||||
Object.keys(servers).map(async (serverName) => {
|
Object.keys(servers).map(async (serverName) => {
|
||||||
const docker = new Docker(getDockerArguments(serverName));
|
const docker = new Docker(getDockerArguments(serverName));
|
||||||
|
|
Loading…
Add table
Reference in a new issue