Skip to content
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(faucet): embed static website #411

Merged
merged 4 commits into from
Jul 16, 2024
Merged

Conversation

Mirko-von-Leipzig
Copy link
Contributor

@Mirko-von-Leipzig Mirko-von-Leipzig commented Jul 16, 2024

This PR simplifies faucet deployment by embedding the website within the binary. This removes the need to separately deploy the website resources.

To facilitate this, this PR also fixes a paper-cut with the javascript callbacks. Previously these were hardcoded to use localhost:8080 as the server address. These would have to be manually edited to the correct URL (which might be a proxy) during deployment. Instead we now use window.location.href which gives the correct url of the current page.

Note: I am not a web expert so if anyone has any input on the above that would be welcome.


The static embedding is handled using a build script + additional dependencies, which I dislike but it seems this is the "blessed" way to achieve this using actix-web.

I tested this locally but without a proxy. Though I don't see why this would matter :)

This removes the need to separately bundle this resource, simpliying
the deployment process.
The server url is now determined using the webpage url instead
of being hardcoded to localhost. This means we no longer have to
manually edit it to whatever IP it is being served on.
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I left one tiny nit inline.

bin/faucet/Cargo.toml Outdated Show resolved Hide resolved
@Mirko-von-Leipzig Mirko-von-Leipzig merged commit ab1bf87 into next Jul 16, 2024
6 checks passed
@Mirko-von-Leipzig Mirko-von-Leipzig deleted the embed-faucet-website branch July 16, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants