fix get crm env variable
This commit is contained in:
parent
e273e12347
commit
03fb5938bc
@ -1,6 +1,9 @@
|
||||
const CracoLessPlugin = require('craco-less');
|
||||
const colors = require('./src/client/UIKit/colors');
|
||||
|
||||
const dotenv = require('dotenv');
|
||||
dotenv.config();
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
{
|
||||
|
||||
@ -19,6 +19,9 @@
|
||||
"cors": "^2.8.5",
|
||||
"craco-less": "^1.17.0",
|
||||
"cross-fetch": "^3.0.6",
|
||||
"dotenv": "^8.2.0",
|
||||
"dotenv-cli": "^4.0.0",
|
||||
"dotenv-webpack": "^5.1.0",
|
||||
"express": "^4.17.1",
|
||||
"express-http-proxy": "^1.6.2",
|
||||
"express-ntlm": "^2.5.2",
|
||||
@ -72,13 +75,13 @@
|
||||
"scripts": {
|
||||
"test": "craco test",
|
||||
"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": "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: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",
|
||||
"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: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 colors = {
|
||||
@ -9,10 +8,10 @@ const colors = {
|
||||
200: '#242424',
|
||||
300: '#373737',
|
||||
400: '#494949',
|
||||
500: '#5B5B5B'
|
||||
500: '#5B5B5B',
|
||||
},
|
||||
'black',
|
||||
0
|
||||
0,
|
||||
),
|
||||
|
||||
white: createColorProxy(
|
||||
@ -24,10 +23,10 @@ const colors = {
|
||||
200: '#DBDBDB',
|
||||
300: '#C8C8C8',
|
||||
400: '#B6B6B6',
|
||||
500: '#A4A4A4'
|
||||
500: '#A4A4A4',
|
||||
},
|
||||
'white',
|
||||
0
|
||||
0,
|
||||
),
|
||||
|
||||
gray: createColorProxy(
|
||||
@ -43,9 +42,9 @@ const colors = {
|
||||
800: '#454545',
|
||||
900: '#393939',
|
||||
1000: '#2E2E2E',
|
||||
1100: '#222222'
|
||||
1100: '#222222',
|
||||
},
|
||||
'gray'
|
||||
'gray',
|
||||
),
|
||||
|
||||
blue: createColorProxy(
|
||||
@ -64,10 +63,10 @@ const colors = {
|
||||
1100: '#060024',
|
||||
1200: '#040018',
|
||||
1300: '#02000C',
|
||||
1400: '#000000'
|
||||
1400: '#000000',
|
||||
},
|
||||
'blue',
|
||||
'#1C01A9'
|
||||
'#1C01A9',
|
||||
),
|
||||
|
||||
blueTemp: createColorProxy(
|
||||
@ -79,16 +78,24 @@ const colors = {
|
||||
400: '#440179',
|
||||
500: '#4E016D',
|
||||
600: '#580161',
|
||||
700: '#620256'
|
||||
700: '#620256',
|
||||
},
|
||||
'blue',
|
||||
'#1C01A9'
|
||||
'#1C01A9',
|
||||
),
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
...colors,
|
||||
primaryColor: isDevelopment ? colors.blueTemp[500] : colors.blue[0],
|
||||
secondaryColor: isDevelopment ? colors.blueTemp[600] : colors.blueTemp[300],
|
||||
tertiaryColor: isDevelopment ? colors.blueTemp[200] : colors.blueTemp[600],
|
||||
const colorTheme = {
|
||||
primaryColor:
|
||||
process.env.REACT_APP_CRM === 'dev' ? colors.blueTemp[500] : colors.blue[0],
|
||||
secondaryColor:
|
||||
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 CRM_URL =
|
||||
process.env.crm !== 'prod'
|
||||
process.env.REACT_APP_CRM === 'dev'
|
||||
? 'http://crmgraphql-dev.evoleasing.ru'
|
||||
: 'http://crm-graphql.evoleasing.ru';
|
||||
export const CRM_PROXY_URL = '/crmgraphql';
|
||||
|
||||
export const CORE_URL =
|
||||
process.env.NODE_ENV === 'development'
|
||||
? '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 nodeExternals = require("webpack-node-externals");
|
||||
const path = require('path');
|
||||
const nodeExternals = require('webpack-node-externals');
|
||||
const dotenv = require('dotenv-webpack');
|
||||
|
||||
module.exports = {
|
||||
mode: process.env.NODE_ENV || "development",
|
||||
target: "node",
|
||||
devtool: "inline-source-map",
|
||||
entry: { server: "./src/server/index.ts" },
|
||||
mode: process.env.NODE_ENV || 'development',
|
||||
target: 'node',
|
||||
devtool: 'inline-source-map',
|
||||
entry: { server: './src/server/index.ts' },
|
||||
output: {
|
||||
path: path.resolve(__dirname, "build"),
|
||||
filename: "[name].js",
|
||||
path: path.resolve(__dirname, 'build'),
|
||||
filename: '[name].js',
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts", ".tsx", ".js"],
|
||||
extensions: ['.ts', '.tsx', '.js'],
|
||||
},
|
||||
// don't compile node_modules
|
||||
externals: [nodeExternals()],
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
chunks: "all",
|
||||
chunks: 'all',
|
||||
},
|
||||
},
|
||||
module: {
|
||||
@ -26,14 +27,15 @@ module.exports = {
|
||||
test: /\.tsx?$/,
|
||||
use: [
|
||||
{
|
||||
loader: "ts-loader",
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
// 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