mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-23 13:35:38 +03:00
a19523b258
Squashed commit of the following:
commit 980e9c2f37640ee204ce0365f6c3bcc74741cc7c
Merge: cb4cae82b 394fc5a9d
Author: Artem Baskal <a.baskal@adguard.com>
Date: Mon Nov 16 14:52:26 2020 +0300
Merge branch 'master' into fix/2237
commit cb4cae82b5b605894d123d6442ea23b24cc90c12
Author: ArtemBaskal <asbaskal@miem.hse.ru>
Date: Thu Nov 12 12:07:49 2020 +0300
minor
commit 5c07dac48067b4ed201aeb59a44e8592ed2b0b67
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Nov 11 19:47:38 2020 +0300
minor
commit 53f60762e520427a080bdfcd94b08b9ed3a63ca4
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Nov 11 19:06:06 2020 +0300
Adapt mobile version
commit 7659ac733ce4606f6fadf30e0eaddbeefd6095d6
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Wed Nov 11 18:31:53 2020 +0300
Fix empty graph offset, return background area below graph
commit 45499adb20a90024dba4b0b4e44ad4f01a1782d5
Author: ArtemBaskal <a.baskal@adguard.com>
Date: Tue Nov 10 17:46:47 2020 +0300
- client: 2237 Update graph drawing library
66 lines
1.7 KiB
JavaScript
Vendored
66 lines
1.7 KiB
JavaScript
Vendored
const merge = require('webpack-merge');
|
|
const yaml = require('js-yaml');
|
|
const fs = require('fs');
|
|
const common = require('./webpack.common.js');
|
|
const { BASE_URL } = require('./constants');
|
|
|
|
const ZERO_HOST = '0.0.0.0';
|
|
const LOCALHOST = '127.0.0.1';
|
|
const DEFAULT_PORT = 80;
|
|
|
|
/**
|
|
* Get document, or throw exception on error
|
|
* @returns {{bind_host: string, bind_port: number}}
|
|
*/
|
|
const importConfig = () => {
|
|
try {
|
|
const doc = yaml.safeLoad(fs.readFileSync('../AdguardHome.yaml', 'utf8'));
|
|
const { bind_host, bind_port } = doc;
|
|
return {
|
|
bind_host,
|
|
bind_port,
|
|
};
|
|
} catch (e) {
|
|
console.error(e);
|
|
return {
|
|
bind_host: ZERO_HOST,
|
|
bind_port: DEFAULT_PORT,
|
|
};
|
|
}
|
|
};
|
|
|
|
const getDevServerConfig = (proxyUrl = BASE_URL) => {
|
|
const { bind_host: host, bind_port: port } = importConfig();
|
|
const { DEV_SERVER_PORT } = process.env;
|
|
|
|
const devServerHost = host === ZERO_HOST ? LOCALHOST : host;
|
|
const devServerPort = DEV_SERVER_PORT || port + 8000;
|
|
|
|
return {
|
|
hot: true,
|
|
open: true,
|
|
host: devServerHost,
|
|
port: devServerPort,
|
|
proxy: {
|
|
[proxyUrl]: `http://${devServerHost}:${port}`,
|
|
},
|
|
};
|
|
};
|
|
|
|
module.exports = merge(common, {
|
|
devtool: 'eval-source-map',
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
loader: 'eslint-loader',
|
|
options: {
|
|
emitWarning: true,
|
|
configFile: 'dev.eslintrc',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
...(process.env.WEBPACK_DEV_SERVER ? { devServer: getDevServerConfig(BASE_URL) } : undefined),
|
|
});
|