3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-25 10:25:01 +00:00

env fixes for web platform hosting

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
metal 2023-03-31 16:35:35 +00:00 committed by GitHub
parent 5b036bb8ec
commit 448293d6ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -52,11 +52,11 @@ const envType = z.object({
DB_DATABASE: z.string().optional().default("zeppelin"),
});
let toValidate = {};
let toValidate = { ...process.env };
const envPath = path.join(rootDir, ".env");
if (fs.existsSync(envPath)) {
const buf = fs.readFileSync(envPath);
toValidate = dotenv.parse(buf);
toValidate = { ...toValidate, ...dotenv.parse(buf) };
}
export const env = envType.parse(toValidate);

View file

@ -3,6 +3,7 @@ const VueLoaderPlugin = require("vue-loader/lib/plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const DotenvPlugin = require("dotenv-webpack");
const merge = require("webpack-merge");
const webpack = require("webpack");
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") {
config = merge(config, {
mode: "production",