From bc6dacf44634757004830346ee12ea1c46004f3c Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Sat, 6 Feb 2016 14:43:57 +0200 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=BA=D0=BE=D0=BD=D1=84=D0=B8?= =?UTF-8?q?=D0=B6=D0=B8=D0=BB=20=D0=B2=D0=B5=D0=B1=D0=BF=D0=B0=D0=BA=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20?= =?UTF-8?q?=D1=81=20=D0=B1=D0=B5=D0=BA=D0=BE=D0=BC=20=D0=B0=D0=BF=D0=B8?= =?UTF-8?q?=D1=88=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ README.md | 8 ++++++++ config/template.dev.json | 3 +++ webpack.config.js | 14 ++++++++++++-- 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 config/template.dev.json diff --git a/.gitignore b/.gitignore index f06235c..e91c398 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ node_modules dist +config/* +!config/template.* diff --git a/README.md b/README.md index a089309..1a75e52 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,10 @@ Ely account frontend application ================================ + +`npm start` - developing mode +`npm run build` - build frontend app +`npm test` - run tests + +Setup +----- +Create `./config/dev.json` based on `./config/template.dev.json`. diff --git a/config/template.dev.json b/config/template.dev.json new file mode 100644 index 0000000..0e6318a --- /dev/null +++ b/config/template.dev.json @@ -0,0 +1,3 @@ +{ + "apiHost": "http://account.l" +} diff --git a/webpack.config.js b/webpack.config.js index 3654cd0..939908f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -30,8 +30,15 @@ var isTest = process.argv.some(function(arg) { process.env.NODE_ENV = JSON.stringify(isProduction ? 'production' : 'development'); -const API_HOST = 'http://account.l'; const CSS_CLASS_TEMPLATE = isProduction ? '[hash:base64:5]' : '[path][name]-[local]'; +var config; + +try { + config = require('./config/dev.json'); +} catch (err) { + console.error('\n\n===\nPlease create dev.json config under ./config based on template.dev.json\n===\n\n'); + throw err; +} var webpackConfig = { entry: { @@ -72,7 +79,10 @@ var webpackConfig = { port: 8080, proxy: { '/api*': { - target: API_HOST + headers: { + host: config.apiHost.replace(/https?:|\//g, '') + }, + target: config.apiHost } }, hot: true,