mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-27 11:45:23 +00:00
Add hostname to Rocket.toml config
This commit is contained in:
parent
23cb550d00
commit
1cdf30f38c
|
@ -1,6 +1,7 @@
|
|||
[global]
|
||||
address = "0.0.0.0"
|
||||
hostname = "conduit.rs"
|
||||
port = 14004
|
||||
address = "0.0.0.0"
|
||||
|
||||
[global.tls]
|
||||
certs = "/etc/letsencrypt/live/matrixtesting.koesters.xyz/fullchain.pem"
|
||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -16,9 +16,9 @@ pub use database::Database;
|
|||
pub use pdu::PduEvent;
|
||||
pub use ruma_wrapper::{MatrixResult, Ruma};
|
||||
|
||||
use rocket::routes;
|
||||
use rocket::{fairing::AdHoc, routes};
|
||||
|
||||
fn setup_rocket(data: Data) -> rocket::Rocket {
|
||||
fn setup_rocket() -> rocket::Rocket {
|
||||
rocket::ignite()
|
||||
.mount(
|
||||
"/",
|
||||
|
@ -68,7 +68,12 @@ fn setup_rocket(data: Data) -> rocket::Rocket {
|
|||
server_server::get_server_keys_deprecated,
|
||||
],
|
||||
)
|
||||
.manage(data)
|
||||
.attach(AdHoc::on_attach("Config", |rocket| {
|
||||
let hostname = rocket.config().get_str("hostname").unwrap_or("localhost");
|
||||
let data = Data::load_or_create(&hostname);
|
||||
|
||||
Ok(rocket.manage(data))
|
||||
}))
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -78,8 +83,5 @@ fn main() {
|
|||
}
|
||||
pretty_env_logger::init();
|
||||
|
||||
let data = Data::load_or_create("conduit.rs");
|
||||
//data.debug();
|
||||
|
||||
setup_rocket(data).launch().unwrap();
|
||||
setup_rocket().launch().unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue