mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 00:10:57 +00:00 
			
		
		
		
	fix cases where configurations are empty
This commit is contained in:
		
							parent
							
								
									d66326b41d
								
							
						
					
					
						commit
						3882dd4f5a
					
				@ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user