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

fix(fullstack): Allow configuration of the public_path #3419

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brianmay
Copy link

@brianmay brianmay commented Dec 20, 2024

This was annoying me. I don't think the default is always sensible.

I ran the tests and they passed, but haven't yet tried running the code.

@brianmay
Copy link
Author

I haven't tried to update the CLI tool, possible that should be updated also. Not sure. Haven't thought that far ahead yet.

@brianmay
Copy link
Author

Tested this change now using real code and it is working.

@brianmay
Copy link
Author

Could also replace public_path() to use some environment variable. Might make it easier to work with the CLI that way.

But being able to customize value from application I think is good also.

Copy link
Member

@jkelleyrtp jkelleyrtp left a comment

Choose a reason for hiding this comment

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

Overall looks good but adding the public_path into the signatures is semver breaking.

I think it'd be better to read an env var instead since I'd rather change the public_dir depending on my deploy setup rather than at compile time.

/// // Server render the application
/// // ...
/// .into_make_service();
/// let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
/// axum::serve(listener, router).await.unwrap();
/// }
/// ```
fn serve_static_assets(self) -> Self
fn serve_static_assets(self, pubic_path: &Path) -> Self
Copy link
Member

Choose a reason for hiding this comment

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

Modifying this signature is not semver compatible meaning we wouldn't be able to release this in version 0.6.2.

I think we can add this with a default impl but since DioxusRouterExt is not sealed, any changes to its signature will need to follow semver rules.

https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature

@brianmay
Copy link
Author

brianmay commented Dec 24, 2024

OK. I must admit I never considered being semver compatible.

Unless any objections, I will revert these changes for one that replaces public_path() with something that reads an environment variable instead. Which is totally fine for my purposes.

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