environment.js 990 字节
Newer Older
J
Jason Park 已提交
1 2 3 4 5 6 7
const path = require('path');

const {
  NODE_ENV = 'production',

  HTTP_PORT = '8080',
  PROXY_PORT = '3000',
J
Jason Park 已提交
8 9 10

  GITHUB_CLIENT_ID,
  GITHUB_CLIENT_SECRET,
J
Jason Park 已提交
11 12 13 14 15 16 17 18
} = process.env;

const __PROD__ = NODE_ENV === 'production';
const __DEV__ = !__PROD__;

const httpPort = parseInt(HTTP_PORT);
const proxyPort = parseInt(PROXY_PORT);

J
Jason Park 已提交
19 20 21
const githubClientId = GITHUB_CLIENT_ID;
const githubClientSecret = GITHUB_CLIENT_SECRET;

J
Jason Park 已提交
22 23 24
const buildPath = path.resolve(__dirname, 'build');
const frontendBuildPath = path.resolve(buildPath, 'frontend');
const backendBuildPath = path.resolve(buildPath, 'backend');
J
Jason Park 已提交
25 26 27 28 29 30 31 32 33 34 35 36

const srcPath = path.resolve(__dirname, 'src');
const frontendSrcPath = path.resolve(srcPath, 'frontend');
const backendSrcPath = path.resolve(srcPath, 'backend');

const apiEndpoint = '/api';

module.exports = {
  __PROD__,
  __DEV__,
  httpPort,
  proxyPort,
J
Jason Park 已提交
37 38
  githubClientId,
  githubClientSecret,
J
Jason Park 已提交
39 40
  frontendBuildPath,
  backendBuildPath,
J
Jason Park 已提交
41 42 43 44
  frontendSrcPath,
  backendSrcPath,
  apiEndpoint,
};