mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 15:51:23 +01:00
hide global services jank in service module
Mainly to make it easier to initialize the SERVICES global correctly in more than one place. Also this stuff really shouldn't live at the crate root anyway.
This commit is contained in:
parent
1fd20cdeba
commit
032e1ca3c6
3 changed files with 22 additions and 20 deletions
|
|
@ -47,7 +47,7 @@ use crate::{
|
|||
self,
|
||||
error::{Error, Result},
|
||||
},
|
||||
Services, SERVICES,
|
||||
Services,
|
||||
};
|
||||
|
||||
pub(crate) async fn run(args: ServeArgs) -> Result<(), error::ServeCommand> {
|
||||
|
|
@ -78,11 +78,9 @@ pub(crate) async fn run(args: ServeArgs) -> Result<(), error::ServeCommand> {
|
|||
.map_err(Error::DatabaseError)?,
|
||||
));
|
||||
|
||||
// This is the first and only time we initialize the SERVICE static
|
||||
*SERVICES.write().unwrap() = Some(Box::leak(Box::new(
|
||||
Services::build(db, config, reload_handles)
|
||||
.map_err(Error::InitializeServices)?,
|
||||
)));
|
||||
Services::build(db, config, reload_handles)
|
||||
.map_err(Error::InitializeServices)?
|
||||
.install();
|
||||
|
||||
services().globals.err_if_server_name_changed()?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue