Not crashing without configs anymore
This commit is contained in:
@@ -9,10 +9,10 @@ mongoose.connect("mongodb://localhost:27017/vinlottis", {
|
|||||||
useNewUrlParser: true
|
useNewUrlParser: true
|
||||||
});
|
});
|
||||||
|
|
||||||
const config = require(path.join(__dirname + "/../config/env/push"));
|
const config = require(path.join(__dirname + "/../config/defaults/push"));
|
||||||
const Subscription = require(path.join(__dirname + "/../schemas/Subscription"));
|
const Subscription = require(path.join(__dirname + "/../schemas/Subscription"));
|
||||||
const lotteryConfig = require(path.join(
|
const lotteryConfig = require(path.join(
|
||||||
__dirname + "/../config/env/lottery.config"
|
__dirname + "/../config/defaults/lottery"
|
||||||
));
|
));
|
||||||
|
|
||||||
router.use((req, res, next) => {
|
router.use((req, res, next) => {
|
||||||
|
|||||||
15
config/defaults/lottery.js
Normal file
15
config/defaults/lottery.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
try {
|
||||||
|
module.exports = require("../env/lottery.config");
|
||||||
|
} catch (e) {
|
||||||
|
console.error(
|
||||||
|
"You haven't defined lottery-configs, you sure you want to continue without them?"
|
||||||
|
);
|
||||||
|
module.exports = {
|
||||||
|
name: "NAME MISSING",
|
||||||
|
phone: "PHONE_MISSING",
|
||||||
|
price: 10,
|
||||||
|
message: "INSERT MESSAGE",
|
||||||
|
date: 5,
|
||||||
|
hours: 15
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
try {
|
try {
|
||||||
module.exports = require("./push.config");
|
module.exports = require("../env/push.config");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(
|
console.error(
|
||||||
"You haven't defined push-parameters, you sure you want to continue without them?"
|
"You haven't defined push-parameters, you sure you want to continue without them?"
|
||||||
@@ -42,7 +42,7 @@ const ServiceWorkerConfig = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
__DATE__: new Date().getTime(),
|
__DATE__: new Date().getTime(),
|
||||||
__PUBLICKEY__: JSON.stringify(require("./env/push").publicKey)
|
__PUBLICKEY__: JSON.stringify(require("./defaults/push").publicKey)
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const env = require("./env/lottery.config.js");
|
const env = require("./defaults/lottery");
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const VueLoaderPlugin = require("vue-loader/lib/plugin");
|
const VueLoaderPlugin = require("vue-loader/lib/plugin");
|
||||||
const MiniCSSExtractPlugin = require("mini-css-extract-plugin");
|
const MiniCSSExtractPlugin = require("mini-css-extract-plugin");
|
||||||
const HtmlPlugin = require("html-webpack-plugin");
|
|
||||||
const helpers = require("./helpers");
|
const helpers = require("./helpers");
|
||||||
|
|
||||||
const webpackConfig = function(isDev) {
|
const webpackConfig = function(isDev) {
|
||||||
@@ -79,7 +78,7 @@ const webpackConfig = function(isDev) {
|
|||||||
__MESSAGE__: JSON.stringify(env.message),
|
__MESSAGE__: JSON.stringify(env.message),
|
||||||
__DATE__: env.date,
|
__DATE__: env.date,
|
||||||
__HOURS__: env.hours,
|
__HOURS__: env.hours,
|
||||||
__PUSHENABLED__: JSON.stringify(require("./env/push") != false)
|
__PUSHENABLED__: JSON.stringify(require("./defaults/push") != false)
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user