From b74c4bd7562f1d89c45df684e27e39ff1bf4de4d Mon Sep 17 00:00:00 2001 From: shariqanwar20 Date: Sun, 29 Aug 2021 17:46:00 +0500 Subject: [PATCH] fixed the issue of .env file (#50) --- src/index.ts | 2 ++ src/lib/configStore.ts | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4caa481..ae51479 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1,3 @@ +export const dotenv = require("dotenv").config({ path: __dirname+'/.env' }) + export {run} from '@oclif/command' diff --git a/src/lib/configStore.ts b/src/lib/configStore.ts index 2b7cfcb..de5aa02 100644 --- a/src/lib/configStore.ts +++ b/src/lib/configStore.ts @@ -1,7 +1,7 @@ const Configstore = require("configstore"); const fs = require("fs"); import axios from "axios"; -require("dotenv").config() +const { dotenv } = require("../index") export const isSessionTokenActive = async (): Promise => { @@ -9,15 +9,13 @@ export const isSessionTokenActive = async (): Promise => { try { if (fs.existsSync(config.path)) { /* config file exists, confirm with API that is this token valid */ - console.log(config.path); - const { API_ENDPOINT } = process.env; - // console.log(API_ENDPOINT); + // console.log(config.path); const tokenFile = JSON.parse(fs.readFileSync(config.path)); - console.log(tokenFile); + // console.log(tokenFile); const { data } = await axios.post( - API_ENDPOINT!, + process.env.API_ENDPOINT!, { query: ` query EntityProfile {