make serving binding address more easily configurable

This commit is contained in:
zyl 2024-11-07 17:27:26 -08:00
parent 190cba1f3a
commit 624853f3ba
Signed by: zyl
SSH key fingerprint: SHA256:uxxbSXbdroP/OnKBGnEDk5q7EKB2razvstC/KmzdXXs
2 changed files with 3 additions and 3 deletions

View file

@ -35,7 +35,7 @@ async fn main() -> eyre::Result<()> {
Mode::Build => {
build(site)?;
}
Mode::Serve => site.serve().await?,
Mode::Serve => site.serve("127.0.0.1:8080").await?,
Mode::Now => {
let time = OffsetDateTime::now_utc();
println!(

View file

@ -147,8 +147,8 @@ fn skip_path(builder: &SiteBuilder, path: &Path) -> bool {
impl Site {
/// Serves the site for development. Don't use this in production.
pub async fn serve(self) -> eyre::Result<()> {
let addr = SocketAddr::from(([127, 0, 0, 1], 8080));
pub async fn serve(self, addr: &str) -> eyre::Result<()> {
let addr: SocketAddr = addr.parse()?;
let mut builder = SiteBuilder::new(self, true)?.prepare()?;
let site = &builder.site;