mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-25 18:25:03 +00:00
env fixes for web platform hosting
Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
parent
5b036bb8ec
commit
448293d6ac
2 changed files with 5 additions and 2 deletions
|
@ -52,11 +52,11 @@ const envType = z.object({
|
||||||
DB_DATABASE: z.string().optional().default("zeppelin"),
|
DB_DATABASE: z.string().optional().default("zeppelin"),
|
||||||
});
|
});
|
||||||
|
|
||||||
let toValidate = {};
|
let toValidate = { ...process.env };
|
||||||
const envPath = path.join(rootDir, ".env");
|
const envPath = path.join(rootDir, ".env");
|
||||||
if (fs.existsSync(envPath)) {
|
if (fs.existsSync(envPath)) {
|
||||||
const buf = fs.readFileSync(envPath);
|
const buf = fs.readFileSync(envPath);
|
||||||
toValidate = dotenv.parse(buf);
|
toValidate = { ...toValidate, ...dotenv.parse(buf) };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const env = envType.parse(toValidate);
|
export const env = envType.parse(toValidate);
|
||||||
|
|
|
@ -3,6 +3,7 @@ const VueLoaderPlugin = require("vue-loader/lib/plugin");
|
||||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||||
const DotenvPlugin = require("dotenv-webpack");
|
const DotenvPlugin = require("dotenv-webpack");
|
||||||
const merge = require("webpack-merge");
|
const merge = require("webpack-merge");
|
||||||
|
const webpack = require("webpack");
|
||||||
|
|
||||||
const targetDir = path.normalize(path.join(__dirname, "dist"));
|
const targetDir = path.normalize(path.join(__dirname, "dist"));
|
||||||
|
|
||||||
|
@ -162,6 +163,8 @@ let config = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === "web") config.plugins.push(new webpack.EnvironmentPlugin(['NODE_ENV', 'API_URL']));
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "production") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
config = merge(config, {
|
config = merge(config, {
|
||||||
mode: "production",
|
mode: "production",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue