make config simpler

main
Mike Fix 6 years ago
parent 115ca7f7ff
commit f653d73ccd

@ -2,10 +2,11 @@ import axios from 'axios'
import debounce from 'lodash.debounce' import debounce from 'lodash.debounce'
import ms from 'ms' import ms from 'ms'
import getConfig from 'next/config' const client = axios.create({
const { publicRuntimeConfig } = getConfig() baseURL: `${
process.env.API_URL || process.env.NODE_ENV === 'production' ? '' : 'http://localhost:4000'
const client = axios.create({ baseURL: publicRuntimeConfig.API_URL }) }/api`
})
const RATE_LIMIT_CODE = 420 const RATE_LIMIT_CODE = 420

@ -1,8 +1,2 @@
// const { PHASE_DEVELOPMENT_SERVER } = require('next/constants') // const { PHASE_DEVELOPMENT_SERVER } = require('next/constants')
// const withOffline = require('next-offline') // const withOffline = require('next-offline')
module.exports = {
publicRuntimeConfig: {
API_URL: process.env.API_URL || 'http://localhost:4000'
}
}

Loading…
Cancel
Save