Settings can now be taken from separate file with local override.

* Various settings in settings-nvr.js module
* settings-nvr-local.js can override settings-nvr.js
* settings-nvr-local is unchecked file
* Both files can be straight maps, or functions returning maps
* webpack env and args available to those functions
This commit is contained in:
Dolf Starreveld
2018-03-07 13:09:43 -08:00
parent 678fb54b21
commit 5727adf3df
12 changed files with 792 additions and 84 deletions

View File

@@ -1,26 +1,35 @@
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
// vim: set et ts=2 sw=2:
//
const webpack = require('webpack');
const NVRSettings = require('./NVRSettings');
const baseConfig = require('./base.config.js');
module.exports = merge(baseConfig, {
devtool: 'inline-source-map',
devServer: {
contentBase: './ui-src',
historyApiFallback: true,
inline: true,
port: 3000,
hot: true,
clientLogLevel: 'info',
proxy: {
'/api': 'http://localhost:8080'
}
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
}),
new webpack.HotModuleReplacementPlugin(),
],
});
module.exports = (env, args) => {
const settingsObject = new NVRSettings(env, args);
const nvrSettings = settingsObject.settings;
return settingsObject.webpackMerge(baseConfig, {
stats: {
warnings: true,
},
devtool: 'inline-source-map',
devServer: {
contentBase: nvrSettings.app_src_dir,
historyApiFallback: true,
inline: true,
port: 3000,
hot: true,
clientLogLevel: 'info',
proxy: {
'/api': `http://${nvrSettings.moonfire.server}:${nvrSettings.moonfire.port}`,
},
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
}),
new webpack.HotModuleReplacementPlugin(),
],
});
};