fix get crm env variable
This commit is contained in:
parent
e273e12347
commit
03fb5938bc
@ -1,6 +1,9 @@
|
|||||||
const CracoLessPlugin = require('craco-less');
|
const CracoLessPlugin = require('craco-less');
|
||||||
const colors = require('./src/client/UIKit/colors');
|
const colors = require('./src/client/UIKit/colors');
|
||||||
|
|
||||||
|
const dotenv = require('dotenv');
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [
|
plugins: [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -19,6 +19,9 @@
|
|||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"craco-less": "^1.17.0",
|
"craco-less": "^1.17.0",
|
||||||
"cross-fetch": "^3.0.6",
|
"cross-fetch": "^3.0.6",
|
||||||
|
"dotenv": "^8.2.0",
|
||||||
|
"dotenv-cli": "^4.0.0",
|
||||||
|
"dotenv-webpack": "^5.1.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-http-proxy": "^1.6.2",
|
"express-http-proxy": "^1.6.2",
|
||||||
"express-ntlm": "^2.5.2",
|
"express-ntlm": "^2.5.2",
|
||||||
@ -72,13 +75,13 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "craco test",
|
"test": "craco test",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"dev": "cross-env NODE_ENV=development concurrently -p name -c \"yellow,magenta,blue\" -n \"webpack-server,nodemon-server,CRA\" \"npm run dev:server:webpack\" \"npm run dev:server:nodemon\" \"npm run dev:client\"",
|
"dev": "cross-env NODE_ENV=development dotenv -e .env -- concurrently -p name -c \"yellow,magenta,blue\" -n \"webpack-server,nodemon-server,CRA\" \"npm run dev:server:webpack\" \"npm run dev:server:nodemon\" \"npm run dev:client\"",
|
||||||
"dev:client:only": "craco start",
|
"dev:client:only": "craco start",
|
||||||
"dev:client": "wait-on -l tcp:3001 && craco start",
|
"dev:client": "wait-on -l tcp:3001 && craco start",
|
||||||
"dev:server": "concurrently -p name -c \"yellow,magenta\" -n \"webpack-server,nodemon-server\" \"npm run dev:server:webpack\" \"npm run dev:server:nodemon\"",
|
"dev:server": "concurrently -p name -c \"yellow,magenta\" -n \"webpack-server,nodemon-server\" \"npm run dev:server:webpack\" \"npm run dev:server:nodemon\"",
|
||||||
"dev:server:webpack": "webpack --config webpack.config.server.js --watch",
|
"dev:server:webpack": "webpack --config webpack.config.server.js --watch",
|
||||||
"dev:server:nodemon": "rimraf build/server.js && wait-on -l build/server.js && nodemon build/server.js",
|
"dev:server:nodemon": "rimraf build/server.js && wait-on -l build/server.js && nodemon build/server.js",
|
||||||
"build": "npm run build:client && npm run build:server",
|
"build": "dotenv -e .env npm run build:client && npm run build:server",
|
||||||
"build:client": "craco build",
|
"build:client": "craco build",
|
||||||
"build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js"
|
"build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
const { isDevelopment } = require('core/tools/environment');
|
|
||||||
const createColorProxy = require('./lib/createColorProxy');
|
const createColorProxy = require('./lib/createColorProxy');
|
||||||
|
|
||||||
const colors = {
|
const colors = {
|
||||||
@ -9,10 +8,10 @@ const colors = {
|
|||||||
200: '#242424',
|
200: '#242424',
|
||||||
300: '#373737',
|
300: '#373737',
|
||||||
400: '#494949',
|
400: '#494949',
|
||||||
500: '#5B5B5B'
|
500: '#5B5B5B',
|
||||||
},
|
},
|
||||||
'black',
|
'black',
|
||||||
0
|
0,
|
||||||
),
|
),
|
||||||
|
|
||||||
white: createColorProxy(
|
white: createColorProxy(
|
||||||
@ -24,10 +23,10 @@ const colors = {
|
|||||||
200: '#DBDBDB',
|
200: '#DBDBDB',
|
||||||
300: '#C8C8C8',
|
300: '#C8C8C8',
|
||||||
400: '#B6B6B6',
|
400: '#B6B6B6',
|
||||||
500: '#A4A4A4'
|
500: '#A4A4A4',
|
||||||
},
|
},
|
||||||
'white',
|
'white',
|
||||||
0
|
0,
|
||||||
),
|
),
|
||||||
|
|
||||||
gray: createColorProxy(
|
gray: createColorProxy(
|
||||||
@ -43,9 +42,9 @@ const colors = {
|
|||||||
800: '#454545',
|
800: '#454545',
|
||||||
900: '#393939',
|
900: '#393939',
|
||||||
1000: '#2E2E2E',
|
1000: '#2E2E2E',
|
||||||
1100: '#222222'
|
1100: '#222222',
|
||||||
},
|
},
|
||||||
'gray'
|
'gray',
|
||||||
),
|
),
|
||||||
|
|
||||||
blue: createColorProxy(
|
blue: createColorProxy(
|
||||||
@ -64,10 +63,10 @@ const colors = {
|
|||||||
1100: '#060024',
|
1100: '#060024',
|
||||||
1200: '#040018',
|
1200: '#040018',
|
||||||
1300: '#02000C',
|
1300: '#02000C',
|
||||||
1400: '#000000'
|
1400: '#000000',
|
||||||
},
|
},
|
||||||
'blue',
|
'blue',
|
||||||
'#1C01A9'
|
'#1C01A9',
|
||||||
),
|
),
|
||||||
|
|
||||||
blueTemp: createColorProxy(
|
blueTemp: createColorProxy(
|
||||||
@ -79,16 +78,24 @@ const colors = {
|
|||||||
400: '#440179',
|
400: '#440179',
|
||||||
500: '#4E016D',
|
500: '#4E016D',
|
||||||
600: '#580161',
|
600: '#580161',
|
||||||
700: '#620256'
|
700: '#620256',
|
||||||
},
|
},
|
||||||
'blue',
|
'blue',
|
||||||
'#1C01A9'
|
'#1C01A9',
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
const colorTheme = {
|
||||||
...colors,
|
primaryColor:
|
||||||
primaryColor: isDevelopment ? colors.blueTemp[500] : colors.blue[0],
|
process.env.REACT_APP_CRM === 'dev' ? colors.blueTemp[500] : colors.blue[0],
|
||||||
secondaryColor: isDevelopment ? colors.blueTemp[600] : colors.blueTemp[300],
|
secondaryColor:
|
||||||
tertiaryColor: isDevelopment ? colors.blueTemp[200] : colors.blueTemp[600],
|
process.env.REACT_APP_CRM === 'dev'
|
||||||
|
? colors.blueTemp[600]
|
||||||
|
: colors.blueTemp[300],
|
||||||
|
tertiaryColor:
|
||||||
|
process.env.REACT_APP_CRM === 'dev'
|
||||||
|
? colors.blueTemp[200]
|
||||||
|
: colors.blueTemp[600],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = Object.assign(colors, colorTheme);
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
export const SERVER_PORT = process.env.NODE_ENV === 'development' ? 3001 : 80;
|
export const SERVER_PORT = process.env.NODE_ENV === 'development' ? 3001 : 80;
|
||||||
|
|
||||||
export const CRM_URL =
|
export const CRM_URL =
|
||||||
process.env.crm !== 'prod'
|
process.env.REACT_APP_CRM === 'dev'
|
||||||
? 'http://crmgraphql-dev.evoleasing.ru'
|
? 'http://crmgraphql-dev.evoleasing.ru'
|
||||||
: 'http://crm-graphql.evoleasing.ru';
|
: 'http://crm-graphql.evoleasing.ru';
|
||||||
export const CRM_PROXY_URL = '/crmgraphql';
|
export const CRM_PROXY_URL = '/crmgraphql';
|
||||||
|
|
||||||
export const CORE_URL =
|
export const CORE_URL =
|
||||||
process.env.NODE_ENV === 'development'
|
process.env.NODE_ENV === 'development'
|
||||||
? 'http://localhost:5000'
|
? 'http://localhost:5000'
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
export const isDevelopment =
|
|
||||||
process.env.NODE_ENV === 'development' || process.env.crm !== 'prod';
|
|
||||||
@ -1,23 +1,24 @@
|
|||||||
const path = require("path");
|
const path = require('path');
|
||||||
const nodeExternals = require("webpack-node-externals");
|
const nodeExternals = require('webpack-node-externals');
|
||||||
|
const dotenv = require('dotenv-webpack');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: process.env.NODE_ENV || "development",
|
mode: process.env.NODE_ENV || 'development',
|
||||||
target: "node",
|
target: 'node',
|
||||||
devtool: "inline-source-map",
|
devtool: 'inline-source-map',
|
||||||
entry: { server: "./src/server/index.ts" },
|
entry: { server: './src/server/index.ts' },
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, "build"),
|
path: path.resolve(__dirname, 'build'),
|
||||||
filename: "[name].js",
|
filename: '[name].js',
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [".ts", ".tsx", ".js"],
|
extensions: ['.ts', '.tsx', '.js'],
|
||||||
},
|
},
|
||||||
// don't compile node_modules
|
// don't compile node_modules
|
||||||
externals: [nodeExternals()],
|
externals: [nodeExternals()],
|
||||||
optimization: {
|
optimization: {
|
||||||
splitChunks: {
|
splitChunks: {
|
||||||
chunks: "all",
|
chunks: 'all',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
@ -26,14 +27,15 @@ module.exports = {
|
|||||||
test: /\.tsx?$/,
|
test: /\.tsx?$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: "ts-loader",
|
loader: 'ts-loader',
|
||||||
options: {
|
options: {
|
||||||
// use the tsconfig in the server directory
|
// use the tsconfig in the server directory
|
||||||
configFile: "src/server/tsconfig.json",
|
configFile: 'src/server/tsconfig.json',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
plugins: [new dotenv()],
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user