From f653d73ccd23b95378ab6d7b8493cf7f95639bbf Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Thu, 7 Feb 2019 14:50:03 -0800 Subject: [PATCH] make config simpler --- lib/api.js | 9 +++++---- next.config.js | 6 ------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/api.js b/lib/api.js index f9920ef..9115323 100644 --- a/lib/api.js +++ b/lib/api.js @@ -2,10 +2,11 @@ import axios from 'axios' import debounce from 'lodash.debounce' import ms from 'ms' -import getConfig from 'next/config' -const { publicRuntimeConfig } = getConfig() - -const client = axios.create({ baseURL: publicRuntimeConfig.API_URL }) +const client = axios.create({ + baseURL: `${ + process.env.API_URL || process.env.NODE_ENV === 'production' ? '' : 'http://localhost:4000' + }/api` +}) const RATE_LIMIT_CODE = 420 diff --git a/next.config.js b/next.config.js index 408e07d..121770d 100644 --- a/next.config.js +++ b/next.config.js @@ -1,8 +1,2 @@ // const { PHASE_DEVELOPMENT_SERVER } = require('next/constants') // const withOffline = require('next-offline') - -module.exports = { - publicRuntimeConfig: { - API_URL: process.env.API_URL || 'http://localhost:4000' - } -}