/**
 * @file for config stuff that's used for webpack configuration, but isn't passed to webpack compiler
 */

import path from 'path'
import i18n from '../i18n'
import manifest from './assets/manifest'

let {
	BASE_API,
	NODE_ENV,
	SENTRY_DSN_PUBLIC,
	GA_ID,
	JWT_SECRET,
	CLIENT_DIST_PATH,
	SENTRY_DSN,
	PORT
} = process.env

// Vars for both server and frontend
BASE_API = BASE_API || '/api/v1'
NODE_ENV = NODE_ENV || 'development'

// Vars for frontend only

// Paths
const rootPath = path.join(__dirname, '../') // = "/"
const distPath = path.join(rootPath, './dist') // = "/dist"
const srcPath = path.join(rootPath, './src') // = "/src"
const srcCommonPath = path.join(srcPath, './common') // = "/src/common"

// Vars for server only
CLIENT_DIST_PATH = CLIENT_DIST_PATH || path.join(distPath, './client')
JWT_SECRET = JWT_SECRET || 'secret'
PORT = PORT || 4000

// compute isProduction based on NODE_ENV
const isProduction = process.env.NODE_ENV === 'production'

export default {
	title: 'Noir',
	publicPath: '/',
	// i18n object
	i18n,
	isProduction,
	// Env vars
	BASE_API,
	NODE_ENV,
	SENTRY_DSN_PUBLIC,
	GA_ID,
	CLIENT_DIST_PATH,
	JWT_SECRET,
	SENTRY_DSN,
	PORT,
	// It's better to define pathes in one file
	// and then use everywhere across app
	srcPath,
	srcCommonPath,
	distPath,
	rootPath,
	// text for WebpackBannerPlugin
	banner:
		'Apache 2 License. Copyright (c) 2017 Vladimir Metnew All Rights Reserved. Repo: https://github.com/Metnew/noir',
	// your manifest.json
	manifest,
	vendor: [
		'react',
		'react-dom',
		'redux',
		'history',
		'react-router',
		'react-router-dom',
		'react-router-redux',
		'semantic-ui-react',
		'redux-thunk',
		'react-helmet',
		'lodash',
		'normalizr',
		'js-cookie',
		'prop-types',
		'store2',
		'styled-components'
	],
	polyfills: ['promise-polyfill', 'isomorphic-fetch']
}

@@ -149,20 +149,22 @@
 rom '../
-i18n
+locals
 '%0Aimport
@@ -268,35 +268,16 @@
 SECRET,%0A
-%09CLIENT_DIST_PATH,%0A
 %09SENTRY_
@@ -720,26 +720,13 @@
 nly%0A
-CLIENT_DIST_PATH =
+const
  CLI
@@ -739,18 +739,17 @@
 ST_PATH 
-%7C%7C
+=
  path.jo

make CLIENT_DIST_PATH non env