pub fn build_service(config: &ServiceConfig) -> Result<FrontEndHandler> {
        GlobalConfigBuilder::new()
            .with_log_error_details(config.core_settings.log_error_details.unwrap_or(false))
            .with_buffer_size_limit(
                config
                    .core_settings
                    .buffer_size_limit
                    .unwrap_or(DEFAULT_BUFFER_SIZE_LIMIT),
            )
            .build();

        let key_info_managers =
            build_key_info_managers(config.key_manager.as_ref().unwrap_or(&Vec::new()))?;

        let providers = build_providers(
            config.provider.as_ref().unwrap_or(&Vec::new()),
            key_info_managers,
        );

        if providers.is_empty() {
            error!("Parsec needs at least one provider to start. No valid provider could be created from the configuration.");
            return Err(Error::new(ErrorKind::InvalidData, "need one provider").into());
        }

        // The authenticators supported by the Parsec service.
        // NOTE: order here is important. The order in which the elements are added here is the
        //       order in which they will be returned to any client requesting them!
        let mut authenticators: Vec<(AuthType, Authenticator)> = Vec::new();
        authenticators.push((AuthType::Direct, Box::from(DirectAuthenticator {})));

        let backend_handlers = build_backend_handlers(providers, &authenticators)?;

        let dispatcher = DispatcherBuilder::new()
            .with_backends(backend_handlers)
            .build()?;

        let mut front_end_handler_builder = FrontEndHandlerBuilder::new();
        for (auth_type, authenticator) in authenticators {
            front_end_handler_builder =
                front_end_handler_builder.with_authenticator(auth_type, authenticator);
        }
        front_end_handler_builder = front_end_handler_builder
            .with_dispatcher(dispatcher)
            .with_body_len_limit(
                config
                    .core_settings
                    .body_len_limit
                    .unwrap_or(DEFAULT_BODY_LEN_LIMIT),
            );

        Ok(front_end_handler_builder.build()?)
    }
/// Evaluate the provided configuration and assemble a service based on it. If the configuration contains
/// any errors or inconsistencies, an `Err` is returned.
///
/// # Errors
/// * if any of the fields specified in the configuration are inconsistent (e.g. key info manager with name 'X'
/// requested for a certain provider does not exist) or if required fields are missing, an error of kind
/// `InvalidData` is returned with a string describing the cause more accurately.
Evaluate the provided configuration and assemble a service based on it. If the configuration contains
any errors or inconsistencies, an `Err` is returned.
Evaluate the provided configuration and assemble a service based on it . If the configuration contains any errors or inconsistencies an ` Err ` is returned .
pub fn build_service(config: &ServiceConfig) -> Result<FrontEndHandler> {
        GlobalConfigBuilder::new()
            .with_log_error_details(config.core_settings.log_error_details.unwrap_or(false))
            .with_buffer_size_limit(
                config
                    .core_settings
                    .buffer_size_limit
                    .unwrap_or(DEFAULT_BUFFER_SIZE_LIMIT),
            )
            .build();
        let key_info_managers =
            build_key_info_managers(config.key_manager.as_ref().unwrap_or(&Vec::new()))?;
        let providers = build_providers(
            config.provider.as_ref().unwrap_or(&Vec::new()),
            key_info_managers,
        );
        if providers.is_empty() {
            error!("Parsec needs at least one provider to start. No valid provider could be created from the configuration.");
            return Err(Error::new(ErrorKind::InvalidData, "need one provider").into());
        }
        // The authenticators supported by the Parsec service.
        // NOTE: order here is important. The order in which the elements are added here is the
        //       order in which they will be returned to any client requesting them!
        let mut authenticators: Vec<(AuthType, Authenticator)> = Vec::new();
        authenticators.push((AuthType::Direct, Box::from(DirectAuthenticator {})));
        let backend_handlers = build_backend_handlers(providers, &authenticators)?;
        let dispatcher = DispatcherBuilder::new()
            .with_backends(backend_handlers)
            .build()?;
        let mut front_end_handler_builder = FrontEndHandlerBuilder::new();
        for (auth_type, authenticator) in authenticators {
            front_end_handler_builder =
                front_end_handler_builder.with_authenticator(auth_type, authenticator);
        }
        front_end_handler_builder = front_end_handler_builder
            .with_dispatcher(dispatcher)
            .with_body_len_limit(
                config
                    .core_settings
                    .body_len_limit
                    .unwrap_or(DEFAULT_BODY_LEN_LIMIT),
            );
        Ok(front_end_handler_builder.build()?)
    }
pub fn build_service ( config : & ServiceConfig ) -> Result < FrontEndHandler > { GlobalConfigBuilder :: new ( ) . with_log_error_details ( config . core_settings . log_error_details . unwrap_or ( false ) ) . with_buffer_size_limit ( config . core_settings . buffer_size_limit . unwrap_or ( DEFAULT_BUFFER_SIZE_LIMIT ) , ) . build ( ) ; let key_info_managers = build_key_info_managers ( config . key_manager . as_ref ( ) . unwrap_or ( & Vec :: new ( ) ) ) ? ; let providers = build_providers ( config . provider . as_ref ( ) . unwrap_or ( & Vec :: new ( ) ) , key_info_managers , ) ; if providers . is_empty ( ) { error ! ( " " ) ; return Err ( Error :: new ( ErrorKind :: InvalidData , " " ) . into ( ) ) ; } // The authenticators supported by the Parsec service. // NOTE: order here is important. The order in which the elements are added here is the //       order in which they will be returned to any client requesting them! let mut authenticators : Vec < ( AuthType , Authenticator ) > = Vec :: new ( ) ; authenticators . push ( ( AuthType :: Direct , Box :: from ( DirectAuthenticator { } ) ) ) ; let backend_handlers = build_backend_handlers ( providers , & authenticators ) ? ; let dispatcher = DispatcherBuilder :: new ( ) . with_backends ( backend_handlers ) . build ( ) ? ; let mut front_end_handler_builder = FrontEndHandlerBuilder :: new ( ) ; for ( auth_type , authenticator ) in authenticators { front_end_handler_builder = front_end_handler_builder . with_authenticator ( auth_type , authenticator ) ; } front_end_handler_builder = front_end_handler_builder . with_dispatcher ( dispatcher ) . with_body_len_limit ( config . core_settings . body_len_limit . unwrap_or ( DEFAULT_BODY_LEN_LIMIT ) , ) ; Ok ( front_end_handler_builder . build ( ) ? ) }
Evaluate the provided configuration and assemble a service based on it.
Evaluate the provided configuration and assemble a service based on it .
config
&ServiceConfig
config
&ServiceConfig
errors
if any of the fields specified in the configuration are inconsistent  or if required fields are missing, an error of kind
`InvalidData` is returned with a string describing the cause more accurately.
if any of the fields specified in the configuration are inconsistent or if required fields are missing an error of kind ` InvalidData ` is returned with a string describing the cause more accurately .