-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(server): configure viewer origin from args #1004
Conversation
Do you mean that it only works if you host your own LHCI server? As I understand, you don't need to build anything yourself - the package from npm for If you aren't hosting your own LHCI server, I'm a bit confused why you'd want to be hosting your own report viewer. If that's the case can you explain your use case a bit more? Otherwise, the code looks good, I'm just not sure why its needed yet. |
@bkjam do you have a moment to give some more information (see above comment)? |
@connorjclark: We've been working on using our own report viewer deployment as well, so maybe I can shed some light. The challenge is that $ cat node_modules/@lhci/server/dist/chunks/entry-*.js | grep -oP 'function[^}]*googlechrome.github.io.{40}'
function La(e){let t="https://googlechrome.github.io";window.addEventListener("message",func This means you have to build By the looks of it, @bkjam preserved priority of the build-time env variable, so people who are building their own package with a custom viewer origin should get consistent behaviour. Though I think that means that packages having a build-time origin will silently ignore any server-side configuration. In any case, this is a feature that my team would use! :) |
Right... we put the build result on npm. Thank you for the clarification. |
Thanks so much, @connorjclark and @brendangadd, for helping with this pull request! The rationale is as explained by @brendangadd. Apologies for missing the comments for so long—I’ll do better going forward. Thanks again for your patience! |
Hi,
I like the solution in #637 which allows us to change the default self-hosted lighthouse report viewer. However, I noticed that the
$VIEWER_ORIGIN
environment variable works only if you build a custom@lhci/server
package. Hence, I made some modifications to configure$VIEWER_ORIGIN
for@lhci/server
via the CLI args.I changed the following things:
--viewer.origin
cli args for server (Default: https://googlechrome.github.io)/v1/viewer/origin
endpoint that retrieves theviewer.origin
valueThis may not be the most optimal solution, so I would appreciate any feedback on my approach and code changes. Thank you :)