Skip to content

Commit

Permalink
Refactor the initializer setup in order to utilize the initializer se…
Browse files Browse the repository at this point in the history
…ttings
  • Loading branch information
yinho999 committed Mar 21, 2024
1 parent d35ef23 commit 27c8b80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions loco-extras/src/initializers/extra_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ impl Initializer for ExtraDbInitializer {
async fn after_routes(&self, router: AxumRouter, ctx: &AppContext) -> Result<AxumRouter> {
let extra_db_config = ctx
.config
.settings
.initializers
.clone()
.ok_or_else(|| Error::Message("settings config not configured".to_string()))?;
.ok_or_else(|| Error::Message("initializers config not configured".to_string()))?;

let extra_db_value = extra_db_config
.get("extra_db")
.ok_or_else(|| Error::Message("settings config not configured".to_string()))?;
.ok_or_else(|| Error::Message("initializers config not configured".to_string()))?;

let extra_db = serde_json::from_value(extra_db_value.clone())?;

Expand Down
2 changes: 1 addition & 1 deletion loco-extras/src/initializers/multi_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl Initializer for MultiDbInitializer {
async fn after_routes(&self, router: AxumRouter, ctx: &AppContext) -> Result<AxumRouter> {
let settings = ctx
.config
.settings
.initializers
.clone()
.ok_or_else(|| Error::Message("settings config not configured".to_string()))?;

Expand Down

0 comments on commit 27c8b80

Please sign in to comment.