wtf is NODE_ENV

This commit is contained in:
Alec LaLonde
2021-07-05 21:43:29 -06:00
committed by Alec LaLonde
parent 9cf6d910d5
commit bad08bf200
2 changed files with 4 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
interface IConfig {
port: number;
nodeEnv: string;
graphqlURL: string;
daoHausGraphqlURL: string;
daoHausPolygonGraphqlURL: string;
@@ -29,6 +30,7 @@ function parseEnv<T extends string | number>(
export const CONFIG: IConfig = {
port: parseEnv(process.env.PORT, 4000),
nodeEnv: parseEnv(process.env.NODE_ENV, 'local'),
graphqlURL: (() => {
const { GRAPHQL_URL: url, GRAPHQL_HOST: host } = process.env;

View File

@@ -1,6 +1,7 @@
/* eslint-disable no-console */
import { createDiscordClient } from '@metafam/discord-bot';
import { CONFIG } from '../../config';
import { Player, PlayerRank_Enum } from '../../lib/autogen/hasura-sdk';
import { client } from '../../lib/hasuraClient';
import { TriggerPayload } from './types';
@@ -14,7 +15,7 @@ export interface UpdateRole {
}
export const updateDiscordRole = async (payload: TriggerPayload<Player>) => {
if (process.env.NODE_ENV !== 'production') return;
if (CONFIG.nodeEnv !== 'production') return;
const { old: oldPlayer, new: newPlayer } = payload.event.data;