Better handling of URL prefix

This commit is contained in:
Lucas Verney 2018-03-02 20:21:25 +01:00
parent 2b04eec393
commit 96e23b809d
3 changed files with 11 additions and 8 deletions

View File

@ -18,7 +18,7 @@ $ npm run build # Build the JS dependencies
Ideally, Python dependencies should be installed in a virtual environment. 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), 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 build` to use the correct path to call the API. Note that the trailing slash
is important. is important.
@ -30,11 +30,13 @@ WSGI to serve the application directly (`application` variable is exported in
`cuizin/__main__.py`). `cuizin/__main__.py`).
You can customize the behavior of the app by passing environment variables: 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 * `CUIZIN_HOST` to set the host on which the webserver should listen to
`localhost` only). Use `HOST=0.0.0.0` to make it world-accessible. (defaults to `localhost` only). Use `HOST=0.0.0.0` to make it
* `PORT` to set the port on which the webserver should listen. Defaults to world-accessible.
`8080`. * `CUIZIN_PORT` to set the port on which the webserver should listen. Defaults
* `DEBUG` to enable or disable the debug from Bottle (defaults to `False`). 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 * `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` modules. Default to using the `weboob-modules` package installed by `pip`
(and which you should regularly update with `pip install --upgrade (and which you should regularly update with `pip install --upgrade

View File

@ -3,6 +3,7 @@
// see http://vuejs-templates.github.io/webpack for documentation. // see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path') const path = require('path')
const process = require('process');
module.exports = { module.exports = {
dev: { dev: {
@ -50,7 +51,7 @@ module.exports = {
// Paths // Paths
assetsRoot: path.resolve(__dirname, '../cuizin/dist'), assetsRoot: path.resolve(__dirname, '../cuizin/dist'),
assetsSubDirectory: 'static', assetsSubDirectory: 'static',
assetsPublicPath: '/', assetsPublicPath: process.env.URL_PREFIX || '/',
/** /**
* Source Maps * Source Maps

View File

@ -3,5 +3,5 @@ const process = require('process');
module.exports = { module.exports = {
NODE_ENV: '"production"', NODE_ENV: '"production"',
API_URL: JSON.stringify(process.env.API_URL || null) API_URL: JSON.stringify(process.env.URL_PREFIX || null)
} }