diff --git a/backend/src/env.ts b/backend/src/env.ts index c1712a3e..3d98506d 100644 --- a/backend/src/env.ts +++ b/backend/src/env.ts @@ -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); diff --git a/dashboard/webpack.config.js b/dashboard/webpack.config.js index 2ae878ca..c64390ab 100644 --- a/dashboard/webpack.config.js +++ b/dashboard/webpack.config.js @@ -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",