From 96e23b809ddc9ff2ab7d38a69e5033c576dc2fe5 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Fri, 2 Mar 2018 20:21:25 +0100 Subject: [PATCH] Better handling of URL prefix --- README.md | 14 ++++++++------ config/index.js | 3 ++- config/prod.env.js | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 53d33ba..e46bad9 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ $ npm run build # Build the JS dependencies Ideally, Python dependencies should be installed in a virtual environment. If you serve the app from a subdirectory (and not the root of your domain), -you might want to run `API_URL=/subdir/ npm run build` instead of `npm run +you might want to run `URL_PREFIX=/subdir/ npm run build` instead of `npm run build` to use the correct path to call the API. Note that the trailing slash is important. @@ -30,11 +30,13 @@ WSGI to serve the application directly (`application` variable is exported in `cuizin/__main__.py`). You can customize the behavior of the app by passing environment variables: -* `HOST` to set the host on which the webserver should listen to (defaults to - `localhost` only). Use `HOST=0.0.0.0` to make it world-accessible. -* `PORT` to set the port on which the webserver should listen. Defaults to - `8080`. -* `DEBUG` to enable or disable the debug from Bottle (defaults to `False`). +* `CUIZIN_HOST` to set the host on which the webserver should listen to + (defaults to `localhost` only). Use `HOST=0.0.0.0` to make it + world-accessible. +* `CUIZIN_PORT` to set the port on which the webserver should listen. Defaults + to `8080`. +* `CUIZIN_DEBUG` to enable or disable the debug from Bottle (defaults to + `False`). * `WEBOOB_MODULES_PATH` to set the path to the local clone of the Weboob modules. Default to using the `weboob-modules` package installed by `pip` (and which you should regularly update with `pip install --upgrade diff --git a/config/index.js b/config/index.js index e0e41f9..96ddeeb 100644 --- a/config/index.js +++ b/config/index.js @@ -3,6 +3,7 @@ // see http://vuejs-templates.github.io/webpack for documentation. const path = require('path') +const process = require('process'); module.exports = { dev: { @@ -50,7 +51,7 @@ module.exports = { // Paths assetsRoot: path.resolve(__dirname, '../cuizin/dist'), assetsSubDirectory: 'static', - assetsPublicPath: '/', + assetsPublicPath: process.env.URL_PREFIX || '/', /** * Source Maps diff --git a/config/prod.env.js b/config/prod.env.js index 4616fd7..e22316b 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -3,5 +3,5 @@ const process = require('process'); module.exports = { NODE_ENV: '"production"', - API_URL: JSON.stringify(process.env.API_URL || null) + API_URL: JSON.stringify(process.env.URL_PREFIX || null) }