-
Notifications
You must be signed in to change notification settings - Fork 5
/
mod.rs
44 lines (38 loc) · 1.08 KB
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Main entrypoint to the service
use std::sync::Arc;
use crate::{settings::DocsSettings, state::State};
// These Modules contain endpoints
mod api;
mod docs;
// These modules are utility or common types/functions
mod common;
mod poem_service;
mod utilities;
pub(crate) use poem_service::get_app_docs;
/// Service level errors
#[derive(thiserror::Error, Debug)]
pub(crate) enum Error {
/// An error with the `EventDB`
#[error(transparent)]
EventDb(#[from] crate::event_db::error::Error),
/// An IO error has occurred
#[error(transparent)]
Io(#[from] std::io::Error),
}
/// # Run Catalyst Gateway Service.
///
/// Runs the Poem based API.
///
/// ## Arguments
///
/// `settings`: &`DocsSetting` - settings for docs
/// `state`: `Arc<State>` - the state
///
/// ## Errors
///
/// `Error::CannotRunService` - cannot run the service
/// `Error::EventDbError` - cannot connect to the event db
/// `Error::IoError` - An IO error has occurred.
pub(crate) async fn run(settings: &DocsSettings, state: Arc<State>) -> Result<(), Error> {
poem_service::run(settings, state).await
}