@@ -120,10 +120,14 @@ where
120120 provided_log_dir : UserProvidedPath ,
121121 use_gpu : bool ,
122122 ) -> anyhow:: Result < Self > {
123+ let runtime_config_dir = runtime_config_path
124+ . and_then ( Path :: parent)
125+ . map ( ToOwned :: to_owned) ;
123126 let toml_resolver =
124127 TomlResolver :: new ( & toml, local_app_dir, provided_state_dir, provided_log_dir) ;
125- let tls_resolver = runtime_config_path. map ( SpinTlsRuntimeConfig :: new) ;
126- let key_value_config_resolver = key_value_config_resolver ( toml_resolver. state_dir ( ) ?) ;
128+ let tls_resolver = runtime_config_dir. clone ( ) . map ( SpinTlsRuntimeConfig :: new) ;
129+ let key_value_config_resolver =
130+ key_value_config_resolver ( runtime_config_dir, toml_resolver. state_dir ( ) ?) ;
127131 let sqlite_config_resolver = sqlite_config_resolver ( toml_resolver. state_dir ( ) ?)
128132 . context ( "failed to resolve sqlite runtime config" ) ?;
129133
@@ -396,9 +400,11 @@ const DEFAULT_KEY_VALUE_STORE_LABEL: &str = "default";
396400/// The key-value runtime configuration resolver.
397401///
398402/// Takes a base path that all local key-value stores which are configured with
399- /// relative paths will be relative to.
403+ /// relative paths will be relative to. It also takes a default store base path
404+ /// which will be used as the directory for the default store.
400405pub fn key_value_config_resolver (
401406 local_store_base_path : Option < PathBuf > ,
407+ default_store_base_path : Option < PathBuf > ,
402408) -> key_value:: RuntimeConfigResolver {
403409 let mut key_value = key_value:: RuntimeConfigResolver :: new ( ) ;
404410
@@ -417,13 +423,12 @@ pub fn key_value_config_resolver(
417423 . unwrap ( ) ;
418424
419425 // Add handling of "default" store.
426+ let default_store_path = default_store_base_path. map ( |p| p. join ( DEFAULT_SPIN_STORE_FILENAME ) ) ;
420427 // Unwraps are safe because the store is known to be serializable as toml.
421428 key_value
422429 . add_default_store :: < SpinKeyValueStore > (
423430 DEFAULT_KEY_VALUE_STORE_LABEL ,
424- SpinKeyValueRuntimeConfig :: new (
425- local_store_base_path. map ( |p| p. join ( DEFAULT_SPIN_STORE_FILENAME ) ) ,
426- ) ,
431+ SpinKeyValueRuntimeConfig :: new ( default_store_path) ,
427432 )
428433 . unwrap ( ) ;
429434
0 commit comments