diff --git a/src/config.ts.example b/src/config.ts.example deleted file mode 100644 index 687ef40..0000000 --- a/src/config.ts.example +++ /dev/null @@ -1,5 +0,0 @@ -{ - "SEASONED_URL": "http://localhost:31459/api/", - "ELASTIC_URL": "http://localhost:9200", - "ELASTIC_INDEX": "shows,movies" -} diff --git a/webpack.config.js b/webpack.config.js index 32314bf..e165f8d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,21 +5,21 @@ const HTMLWebpackPlugin = require("html-webpack-plugin"); const { VueLoaderPlugin } = require("vue-loader"); const TerserPlugin = require("terser-webpack-plugin"); const dotenv = require("dotenv").config({ path: "./.env" }); +const dotenvExample = require("dotenv").config({ path: "./.env.example" }); const sourcePath = path.resolve(__dirname, "src"); const indexFile = path.join(sourcePath, "index.html"); const javascriptEntry = path.join(sourcePath, "main.ts"); const publicPath = path.resolve(__dirname, "public"); const isProd = process.env.NODE_ENV === "production"; +const variables = dotenv.parsed || dotenvExample.parsed; // Merge inn all process.env values that match dotenv keys -if (dotenv.parsed) { - Object.keys(process.env).forEach(key => { - if (key in dotenv.parsed) { - dotenv.parsed[key] = process.env[key]; - } - }); -} +Object.keys(process.env).forEach(key => { + if (key in variables) { + variables[key] = process.env[key]; + } +}); module.exports = { mode: process.env.NODE_ENV, @@ -79,7 +79,7 @@ module.exports = { minify: isProd }), new webpack.DefinePlugin({ - "process.env": JSON.stringify(dotenv.parsed) + "process.env": JSON.stringify(variables) }) ], resolve: {