configs changes
parent
d926f145cc
commit
af084e84af
12
config.js
12
config.js
|
@ -1,4 +1,5 @@
|
||||||
const dev = {
|
const dev = {
|
||||||
|
NODE_ENV: "development",
|
||||||
REVERSE_PROXY_API_URL: "http://localhost:5050",
|
REVERSE_PROXY_API_URL: "http://localhost:5050",
|
||||||
CHATBOT_API_URL: "http://localhost:5061",
|
CHATBOT_API_URL: "http://localhost:5061",
|
||||||
REVERSE_PROXY_DOCS_URL: "https://toodle.ddns.net/hedgedoc/s/UkJ6S5NJz"
|
REVERSE_PROXY_DOCS_URL: "https://toodle.ddns.net/hedgedoc/s/UkJ6S5NJz"
|
||||||
|
@ -12,4 +13,13 @@ const prod = {
|
||||||
REVERSE_PROXY_DOCS_URL: "https://toodle.ddns.net/hedgedoc/s/UkJ6S5NJz"
|
REVERSE_PROXY_DOCS_URL: "https://toodle.ddns.net/hedgedoc/s/UkJ6S5NJz"
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { dev, prod };
|
const getConfig = env => {
|
||||||
|
const config = env === "prod" ? prod : dev;
|
||||||
|
let configs = {};
|
||||||
|
Object.keys(config).forEach(z => {
|
||||||
|
configs[`process.env.${z}`] = JSON.stringify(config[z]);
|
||||||
|
});
|
||||||
|
return configs;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = getConfig;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import api from "./api";
|
||||||
import { sendHttpRequest } from "../../redux/actions/httpActions";
|
import { sendHttpRequest } from "../../redux/actions/httpActions";
|
||||||
|
|
||||||
export function loadReleaseNotes() {
|
export function loadReleaseNotes() {
|
||||||
return async function (dispatch, getState) {
|
return async function(dispatch, getState) {
|
||||||
try {
|
try {
|
||||||
const notes = getState().releaseNotes;
|
const notes = getState().releaseNotes;
|
||||||
if (notes && (notes.loading || notes.loaded)) return;
|
if (notes && (notes.loading || notes.loaded)) return;
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const config = require("./config");
|
const getConfig = require("./config");
|
||||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||||
|
|
||||||
process.env.NODE_ENV = "development";
|
process.env.NODE_ENV = "development";
|
||||||
|
const configs = getConfig("dev");
|
||||||
let configs = {};
|
|
||||||
Object.keys(config.dev).forEach(z => {
|
|
||||||
configs[`process.env.${z}`] = JSON.stringify(config.dev[z]);
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: "development",
|
mode: "development",
|
||||||
|
|
|
@ -4,9 +4,11 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||||
const webpackBundleAnalyzer = require("webpack-bundle-analyzer");
|
const webpackBundleAnalyzer = require("webpack-bundle-analyzer");
|
||||||
const CopyPlugin = require("copy-webpack-plugin");
|
const CopyPlugin = require("copy-webpack-plugin");
|
||||||
|
const getConfig = require("./config");
|
||||||
|
|
||||||
process.env.NODE_ENV = "production";
|
process.env.NODE_ENV = "production";
|
||||||
process.env.PUBLIC_URL = "/reverse-proxy";
|
process.env.PUBLIC_URL = "/reverse-proxy";
|
||||||
|
const configs = getConfig("prod");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: "production",
|
mode: "production",
|
||||||
|
@ -26,20 +28,7 @@ module.exports = {
|
||||||
filename: "[name].[contenthash].css"
|
filename: "[name].[contenthash].css"
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin(configs),
|
||||||
// This global makes sure React is built in prod mode.
|
|
||||||
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
|
|
||||||
"process.env.PUBLIC_URL": JSON.stringify(process.env.PUBLIC_URL),
|
|
||||||
"process.env.REVERSE_PROXY_API_URL": JSON.stringify(
|
|
||||||
"https://toodle.ddns.net/reverse-proxy-api"
|
|
||||||
),
|
|
||||||
"process.env.CHATBOT_API_URL": JSON.stringify(
|
|
||||||
"https://toodle.ddns.net/chatbot-api"
|
|
||||||
),
|
|
||||||
"process.env.REVERSE_PROXY_DOCS_URL": JSON.stringify(
|
|
||||||
"https://toodle.ddns.net/docs/books/reverse-proxy"
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: "src/index.html",
|
template: "src/index.html",
|
||||||
favicon: "src/favicon.ico",
|
favicon: "src/favicon.ico",
|
||||||
|
|
Loading…
Reference in New Issue