Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static detect(options: any = {}, filename?: string): TruffleConfig {
let configFile;
const configPath = options.config;
if (configPath) {
configFile = path.isAbsolute(configPath)
? configPath
: path.resolve(configPath);
} else {
configFile = TruffleConfig.search(options, filename);
}
if (!configFile) {
throw new TruffleError("Could not find suitable configuration file.");
}
return TruffleConfig.load(configFile, options);
}