Skip to content

Commit

Permalink
Display a message on startup.
Browse files Browse the repository at this point in the history
Fixes #53
  • Loading branch information
AustinWise committed Oct 8, 2022
1 parent a8af27e commit 207aaa7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
0.4.3 (2022-10-08)
=====

* Fix lack of ready message when in release builds.
[#53](https://github.com/AustinWise/smeagol/issues/53)

0.4.2 (2022-10-07)
=====

* When editing a page, add the ability to preview your how your changes will
look before saving [#51](https://github.com/AustinWise/smeagol/issues/51)
* Update dependencies, including Rocket web framework to 0.5.0-rc.2 .

0.4.1 (2022-04-16)
=====
Expand Down
23 changes: 20 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ fn create_wiki() -> Result<Wiki, MyError> {
let git_repo = args
.git_repo()
.unwrap_or_else(|| std::env::current_dir().unwrap());

println!("Loading wiki in {}", git_repo.display());

let repo = create_repository(args.use_fs(), git_repo)?;
let settings = parse_settings_from_args(args, &repo)?;
Wiki::new(settings, repo)
Expand All @@ -53,13 +56,27 @@ async fn main() -> Result<(), rocket::Error> {
}
};
WIKI.set(wiki).expect("Failed to set global wiki pointer.");

println!("Wiki loaded");

let address = WIKI.get().unwrap().settings().host();
let port = WIKI.get().unwrap().settings().port();

let figment = rocket::Config::figment()
.merge(("port", WIKI.get().unwrap().settings().port()))
.merge(("address", WIKI.get().unwrap().settings().host()));
.merge(("port", port))
.merge(("address", address));
let rocket = rocket::custom(figment);
let rocket = requests::mount_routes(rocket);
let rocket = assets::mount_routes(rocket);
let _rocket = rocket.ignite().await?.launch().await?;
let rocket = rocket.ignite().await?;

println!("Smeagol is listening on http://{address}:{port}/");

let rocket = rocket.launch().await?;

println!("Shutting down");

drop(rocket);

Ok(())
}

0 comments on commit 207aaa7

Please sign in to comment.