@@ -7,7 +7,7 @@ use std::sync::Arc;
77use crate :: email:: Emails ;
88use crate :: metrics:: { InstanceMetrics , ServiceMetrics } ;
99use crate :: rate_limiter:: RateLimiter ;
10- use crate :: storage:: Storage ;
10+ use crate :: storage:: { Storage , StorageConfig } ;
1111use axum:: extract:: { FromRef , FromRequestParts , State } ;
1212use bon:: Builder ;
1313use crates_io_github:: GitHubClient ;
@@ -142,6 +142,16 @@ impl<S: app_builder::State> AppBuilder<S> {
142142 self . primary_database ( primary_database)
143143 . maybe_replica_database ( replica_database)
144144 }
145+
146+ pub fn storage_from_config (
147+ self ,
148+ config : & StorageConfig ,
149+ ) -> AppBuilder < app_builder:: SetStorage < S > >
150+ where
151+ S :: Storage : app_builder:: IsUnset ,
152+ {
153+ self . storage ( Arc :: new ( Storage :: from_config ( config) ) )
154+ }
145155}
146156
147157impl App {
@@ -158,7 +168,7 @@ impl App {
158168 . github ( github)
159169 . github_oauth_from_config ( & config)
160170 . emails ( emails)
161- . storage ( Arc :: new ( Storage :: from_config ( & config. storage ) ) )
171+ . storage_from_config ( & config. storage )
162172 . rate_limiter ( RateLimiter :: new ( config. rate_limiter . clone ( ) ) )
163173 . config ( Arc :: new ( config) )
164174 . build ( )
0 commit comments