Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// compile the final docker-compose
finalDockerCompose = {
...finalDockerCompose,
...compose,
};
if (!dotenv) {
return;
}
const dotenvPath = filesystem.resolve(path, '.env');
let finalDotEnv = {};
const exists = await filesystem.exists(dotenvPath);
if (exists) {
const raw = await filesystem.read(dotenvPath);
finalDotEnv = parseEnv(raw);
}
finalDotEnv = {
...finalDotEnv,
...dotenv,
};
await filesystem.write(dotenvPath, stringifyToEnv(finalDotEnv));
});
function getConfigPath(fileName: string, strict: boolean = false) {
const configPath = filesystem.path(fileName);
if (filesystem.exists(configPath)) {
print.info(`Configuration file found ${configPath}`);
return configPath;
}
if (strict) {
throw new FileNotFoundException(`File not found ${configPath}`);
} else {
print.warning(
`Unable to find "${fileName}" reverting to default configuration`,
);
}
return false;
}
async function getLastComposeFile() {
const exists = await filesystem.exists(lastDCPath);
if (!exists) {
return null;
}
return filesystem.read(lastDCPath);
}