Add more .env configuration: HomeURL on Results page and Locale#175
Add more .env configuration: HomeURL on Results page and Locale#175WBT112 wants to merge 24 commits intositespeedio:mainfrom
Conversation
|
@soulgalore : I hope this saves you some time, excuse the messed up git history. |
|
The reading of the configuration is kind of broken right now since it depends on how the modules is loaded. Your fix is good, but I want to refactor that code a little so its more safe overall for the whole code base, hope to have it done at the end of today. |
|
I fixed the configuration issue in #177 - I'm gonna do a separate a little simpler PR just to fix the locale (the naming there isn't perfect when I first added it). |
|
@soulgalore Just tested this, looks like the lazyload is no longer needed (which would be cool, btw.) , right ? |
|
Yes correct. I renamed the property to localization:locale . I plan to do a major release before new year. |
|
This looks good now for me. |
|
Sorry for being slow on this. In general: one change per PR makes it easier for me to merge/add comments. It also makes the history easier. |
|
Not sure if this is still needed. I think yes. |
This adds 2 more working parameters to .env file:
SITESPEED_IO_HTML_HOMEURL : The URL which opens when you click on the left upper logo on the results page. Currently leads to sitespeed.io, which creates a dead-end for users.
This passes SITESPEED_IO_HTML_HOMEURL from .env through Compose into the server’s sitespeed.io config, which is merged into each job and forwarded to sitespeed.io as html.homeUrl, so the report logo can link to the desired URL. Also falls back to the dockerdefault.yaml if nothing is set.
Default value is http://127.0.0.1:3000/ which is working for local Docker setup.
LOCALIZATION_DEFAULTLOCALE: The (default) locale used from the server/locales folder. y18n initialization was happening before nconf had loaded env/defaults, so the locale got stuck at the built-in default (en). Switched to lazy initialization and wired localization:defaultLocale from env/Compose, if nothing is set falling back to the YAML default. This makes GUI locale switches via env work as intended.
Maybe there is a more elegant solution to this.
Default value is: en.
This was tested with local Docker setup.
CODEX assisted in implementing this.