@@ -18,6 +18,7 @@ use si_crypto::{
1818use si_data_nats:: NatsConfig ;
1919use si_data_pg:: PgPoolConfig ;
2020use si_layer_cache:: db:: LayerDbConfig ;
21+ use si_service_endpoints:: ServiceEndpointsConfig ;
2122pub ( crate ) use si_settings:: StandardConfig ;
2223pub use si_settings:: StandardConfigFile ;
2324use si_std:: CanonicalFileError ;
@@ -56,7 +57,7 @@ impl ConfigError {
5657type Result < T > = std:: result:: Result < T , ConfigError > ;
5758
5859/// The config for the forklift server.
59- #[ derive( Debug , Builder ) ]
60+ #[ derive( Debug , Builder , Serialize ) ]
6061pub struct Config {
6162 #[ builder( default = "random_instance_id()" ) ]
6263 instance_id : String ,
@@ -87,6 +88,9 @@ pub struct Config {
8788
8889 #[ builder( default = "default_quiescent_period()" ) ]
8990 quiescent_period : Duration ,
91+
92+ #[ builder( default = "default_service_endpoints_config()" ) ]
93+ service_endpoints : ServiceEndpointsConfig ,
9094}
9195
9296impl StandardConfig for Config {
@@ -152,6 +156,12 @@ impl Config {
152156 pub fn quiescent_period ( & self ) -> Duration {
153157 self . quiescent_period
154158 }
159+
160+ /// Gets a reference to the config's service endpoints configuration.
161+ #[ must_use]
162+ pub fn service_endpoints ( & self ) -> & ServiceEndpointsConfig {
163+ & self . service_endpoints
164+ }
155165}
156166
157167#[ derive( Clone , Debug , Deserialize , Serialize ) ]
@@ -179,6 +189,8 @@ pub struct ConfigFile {
179189 layer_db_config : LayerDbConfig ,
180190 #[ serde( default = "default_quiescent_period_secs" ) ]
181191 quiescent_period_secs : u64 ,
192+ #[ serde( default = "default_service_endpoints_config" ) ]
193+ service_endpoints : ServiceEndpointsConfig ,
182194}
183195
184196impl Default for ConfigFile {
@@ -194,6 +206,7 @@ impl Default for ConfigFile {
194206 symmetric_crypto_service : default_symmetric_crypto_config ( ) ,
195207 layer_db_config : default_layer_db_config ( ) ,
196208 quiescent_period_secs : default_quiescent_period_secs ( ) ,
209+ service_endpoints : default_service_endpoints_config ( ) ,
197210 }
198211 }
199212}
@@ -219,6 +232,7 @@ impl TryFrom<ConfigFile> for Config {
219232 config. parallel_build_limit ( value. edda_parallel_build_limit ) ;
220233 config. instance_id ( value. instance_id ) ;
221234 config. quiescent_period ( Duration :: from_secs ( value. quiescent_period_secs ) ) ;
235+ config. service_endpoints ( value. service_endpoints ) ;
222236 config. build ( ) . map_err ( Into :: into)
223237 }
224238}
@@ -259,6 +273,10 @@ fn default_quiescent_period_secs() -> u64 {
259273 DEFAULT_QUIESCENT_PERIOD_SECS
260274}
261275
276+ fn default_service_endpoints_config ( ) -> ServiceEndpointsConfig {
277+ ServiceEndpointsConfig :: new ( 0 )
278+ }
279+
262280#[ allow( clippy:: disallowed_methods) ] // Used to determine if running in development
263281pub fn detect_and_configure_development ( config : & mut ConfigFile ) -> Result < ( ) > {
264282 if env:: var ( "BUCK_RUN_BUILD_ID" ) . is_ok ( ) || env:: var ( "BUCK_BUILD_ID" ) . is_ok ( ) {
0 commit comments