dspace-angular
dspace-angular copied to clipboard
yarn start:dev - Environment variables, YML configurations no longer appear to be honored for "ui" settings
Bug
Version
7.3, node:14
Description
In 7.2, the dev server launched by yarn start:dev was configurable via environment variables (DSPACE_HOST/DSPACE_UI_HOST) or the YML configuration files (config.dev.yml) as described in documentation.
As of 7.3, yarn start:dev appears always lanch a development server with defaults (localhost:4000), despite logging claims of applying configuration.
Related? https://github.com/DSpace/dspace-angular/commit/808d4e925a5f6503f8392aefa47383676e797b08
Steps to reproduce the behavior:
Configure the development server via either method.
log
> yarn start:dev
[...]
Building development app config
Overriding app config with /app/config/config.dev.yml
Applying environment variable DSPACE_UI_HOST with value 0.0.0.0
Applying environment variable DSPACE_UI_PORT with value 4000
Angular config.json file generated correctly at /app/src/assets/config.json
[...]
** Angular Live Development Server is listening on localhost:4000, open your browser on http://localhost:4000/ **
ENV
> export
[...]
export DSPACE_UI_HOST='0.0.0.0'
export DSPACE_UI_PORT='4000'
[...]
config.dev.yml
> cat /app/config/config.dev.yml
ui:
ssl: false
host: 0.0.0.0
port: 4000
nameSpace: /
[...]
config.json
> cat /app/src/assets/config.json
[...]
"ui": {
"ssl": false,
"host": "0.0.0.0",
"port": 4000,
"nameSpace": "/",
"rateLimiter": {
"windowMs": 60000,
"max": 500
},
"baseUrl": "http://0.0.0.0:4000/"
},
[...]
Expected behavior
Configuration is honored.
** Angular Live Development Server is listening on 0.0.0.0:4000, open your browser on http://localhost:4000/ **
Moving this over to 7.4 as I'm able to reproduce this locally, but it seems specific to the "ui" section of the configuration.
All other configurations work fine in config.dev.yml using yarn start:dev. E.g. changing the "rest" settings works perfectly.
So, the only way that I've found to reproduce it is to change the "ui" settings in config.dev.yml as described above to something like:
ui:
ssl: false
host: 0.0.0.0
port: 4000
nameSpace: /
The result is that the UI runs on "localhost:4000" instead of "0.0.0.0:4000". In other words you see this from yarn start:dev:
Angular Live Development Server is listening on localhost:4000, open your browser on http://localhost:4000/
If you make that same host: 0.0.0.0 change to config.prod.yml & use yarn start, you'll instead get a message that says:
Listening at http://0.0.0.0:4000/
All that said, I'm going to bump the priority down to low as this seems to only impact the "ui" section of config.dev.yml. Though I'd still welcome fixes if there's a really quick fix here.
NOTE: Another way to test this is to change the UI's port to something like 3000. If you use yarn start:dev with config.dev.yml, the port will switch back to 4000 when it starts up. But, if you use yarn start with config.prod.yml, then it'll use port 3000 as requested.
Adding a zero hour estimate as this fix will be included in the fix for #1795