@@ -245,8 +245,30 @@ pub struct SgxCollateralService {
245245 help = "Certs Service URL (default: https://certificates.trustedservices.intel.com/)"
246246 ) ]
247247 pub certs_service_url : Option < String > ,
248- #[ clap( long = "early_update" , help = "Enable early update (default: false)" ) ]
249- pub is_early_update : bool ,
248+ #[ clap(
249+ long = "update_policy" ,
250+ default_value = "early" ,
251+ help = "Update policy (early(default) or standard)"
252+ ) ]
253+ pub update_policy : UpdatePolicy ,
254+ }
255+
256+ #[ derive( Clone , Debug , PartialEq ) ]
257+ pub enum UpdatePolicy {
258+ Early ,
259+ Standard ,
260+ }
261+
262+ impl FromStr for UpdatePolicy {
263+ type Err = anyhow:: Error ;
264+
265+ fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
266+ match s. to_lowercase ( ) . as_str ( ) {
267+ "early" => Ok ( Self :: Early ) ,
268+ "standard" => Ok ( Self :: Standard ) ,
269+ _ => Err ( anyhow ! ( "invalid update policy: {}" , s) ) ,
270+ }
271+ }
250272}
251273
252274impl SgxCollateralService {
@@ -268,7 +290,7 @@ impl From<SgxCollateralService> for PCSClient {
268290 Self :: new (
269291 service. get_pccs_url ( ) . as_str ( ) ,
270292 service. get_certs_service_url ( ) . as_str ( ) ,
271- service. is_early_update ,
293+ service. update_policy == UpdatePolicy :: Early ,
272294 )
273295 }
274296}
0 commit comments