import * as dotenv from 'dotenv';
import * as path from 'path';

// Load the .env file from the ~/.protege file
dotenv.config({
  path: path.join(process.env.HOME ?? '~', '.protege'),
});

/**
 * Config file
 */
export const config: {
  env: {
    environment: string;
    tenant_name: string;
  };
  protege: {
    endpoint: string;
    apiKey?: string;
  };
  auth0: {
    domain: string;
    clientId: string;
    audience: string;
    tokens: string | undefined;
  };
} = {
  env: {
    environment: process.env.NODE_ENV ?? 'development',
    tenant_name: process.env.TENANT_NAME ?? 'dev',
  },
  protege: {
    endpoint: process.env.PROTEGE_ENGINE_ENDPOINT ?? 'http://localhost:8081/v3/graphql',
    apiKey: process.env.PROTEGE_ENGINE_API_KEY,
  },
  auth0: {
    domain: process.env.AUTH0_DOMAIN ?? 'dev-76hie6ffyq46jxup.us.auth0.com',
    clientId: process.env.AUTH0_CLIENT_ID ?? 'CWqXKzcqnD7vRPBAc5pkjtpHy5nRzydC',
    audience: process.env.AUTH0_AUDIENCE ?? 'https://engine.dev.teachprotege.ai',
    tokens: process.env.AUTH0_TOKENS,
  },
};
