diff --git a/src/lib/getInput.ts b/src/lib/getInput.ts index 52fc61e..880c4d0 100644 --- a/src/lib/getInput.ts +++ b/src/lib/getInput.ts @@ -120,8 +120,7 @@ class GetInput { * @returns {boolean} */ _hasPreviousConfigInFile(): boolean { - const filePath = `${__dirname}/${commonConfig.configFile}`; - const configData = readJsonFile(filePath); + const configData = readJsonFile(commonConfig.configFile); let pass = true; for (const key in USER_CONFIGS) { diff --git a/src/lib/util.ts b/src/lib/util.ts index 7b568ee..10865e8 100644 --- a/src/lib/util.ts +++ b/src/lib/util.ts @@ -66,10 +66,10 @@ export function getPathSuffixFromUrl(url: string): string { return urlParts.slice(1).join('/'); } -export function readJsonFile(filePath: string): any { +export function readJsonFile(fileName: string): any { let fileContent = null; try { - const data = fs.readFileSync(filePath, 'utf-8'); + const data = fs.readFileSync(fileName, 'utf-8'); fileContent = JSON.parse(data); } catch (err) { // console.log(err); diff --git a/src/terraform/main.ts b/src/terraform/main.ts index 3acdb4f..694851e 100644 --- a/src/terraform/main.ts +++ b/src/terraform/main.ts @@ -7,8 +7,7 @@ import commonConfig from '../config/common.json'; const app = new App(); -const filePath = `${__dirname}/${commonConfig.configFile}`; -const userInput = readJsonFile(filePath); +const userInput = readJsonFile(commonConfig.configFile); new BackendStack(app, commonConfig.backendStackName, { accessKey: userInput.aws.accessKeyId,