mirror of https://github.com/apache/superset.git
fix(webpack-dev-server): parse env args (#19744)
This commit is contained in:
parent
686ce33ea5
commit
e986a1746f
|
@ -695,10 +695,10 @@ npm run dev-server
|
||||||
npm run dev-server -- --port=9001
|
npm run dev-server -- --port=9001
|
||||||
|
|
||||||
# Proxy backend requests to a Flask server running on a non-default port
|
# Proxy backend requests to a Flask server running on a non-default port
|
||||||
npm run dev-server -- --supersetPort=8081
|
npm run dev-server -- --env=--supersetPort=8081
|
||||||
|
|
||||||
# Proxy to a remote backend but serve local assets
|
# Proxy to a remote backend but serve local assets
|
||||||
npm run dev-server -- --superset=https://superset-dev.example.com
|
npm run dev-server -- --env=--superset=https://superset-dev.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
The `--superset=` option is useful in case you want to debug a production issue or have to setup Superset behind a firewall. It allows you to run Flask server in another environment while keep assets building locally for the best developer experience.
|
The `--superset=` option is useful in case you want to debug a production issue or have to setup Superset behind a firewall. It allows you to run Flask server in another environment while keep assets building locally for the best developer experience.
|
||||||
|
|
|
@ -18,10 +18,18 @@
|
||||||
*/
|
*/
|
||||||
const zlib = require('zlib');
|
const zlib = require('zlib');
|
||||||
|
|
||||||
|
const yargs = require('yargs');
|
||||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
const parsedArgs = require('yargs').argv;
|
const parsedArgs = yargs.argv;
|
||||||
|
|
||||||
const { supersetPort = 8088, superset: supersetUrl = null } = parsedArgs;
|
const parsedEnvArg = () => {
|
||||||
|
if (parsedArgs.env) {
|
||||||
|
return yargs(parsedArgs.env).argv;
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
};
|
||||||
|
|
||||||
|
const { supersetPort = 8088, superset: supersetUrl = null } = parsedEnvArg();
|
||||||
const backend = (supersetUrl || `http://localhost:${supersetPort}`).replace(
|
const backend = (supersetUrl || `http://localhost:${supersetPort}`).replace(
|
||||||
'//+$/',
|
'//+$/',
|
||||||
'',
|
'',
|
||||||
|
|
Loading…
Reference in New Issue