Skip to content

Commit

Permalink
fixed the issue of .env file (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
shariqanwar20 committed Aug 29, 2021
1 parent 6667a31 commit b74c4bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export const dotenv = require("dotenv").config({ path: __dirname+'/.env' })

export {run} from '@oclif/command'
10 changes: 4 additions & 6 deletions src/lib/configStore.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
const Configstore = require("configstore");
const fs = require("fs");
import axios from "axios";
require("dotenv").config()
const { dotenv } = require("../index")


export const isSessionTokenActive = async (): Promise<boolean> => {
const config = new Configstore("panacloud");
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 {
Expand Down

0 comments on commit b74c4bd

Please sign in to comment.