Skip to content

Commit 8537a1d

Browse files
committed
fix fallback behavior
1 parent 2c01ce5 commit 8537a1d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

infra-cdk/lib/utils/config-manager.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,17 @@ export class ConfigManager {
4949
private _loadConfig(configFile: string): AppConfig {
5050
let configPath: string
5151

52+
// Uses the specified configFile if the file exists
53+
// otherwise fallsback to existing behavior where the configFile should be
54+
// named config.yaml and be in the infra-cdk directory. Throws an error if the
55+
// configFile does not exist and is not the default "config.yaml"
5256
if (fs.existsSync(configFile)) {
5357
configPath = configFile
5458
} else {
59+
if (path.basename(configFile) !== "config.yaml") {
60+
throw new Error(`Configuration file '${configFile}' not found.`)
61+
}
5562
const defaultConfigPath = path.join(__dirname, "..", "..", configFile)
56-
console.warn(`WARNING: Using '${defaultConfigPath}' instead.`)
5763
configPath = defaultConfigPath
5864
}
5965

0 commit comments

Comments
 (0)