uk.gov.hmrc.customs.api.common

# config

#### package config

Visibility

1. Public
2. All

### Type Members

1. #### class ConfigValidationNelAdaptor extends AnyRef

   We need a wrapper for ServicesConfig as the current API rely's on throwing exceptions for signalling failure - this is fail fast behaviour.

   We need a wrapper for ServicesConfig as the current API rely's on throwing exceptions for signalling failure - this is fail fast behaviour. What we want is to aggregate errors (on application startup). The `ValidationNel` class in the `scalaz` library gives a type that allows us aggregate errors. It's declaration is `type ValidationNel[E, +X] = Validation[NonEmptyList[E], X]` `Nel` is short for `NonEmptyList` which is simply a `List` that is guaranteed to contain at least 1 item.

   Example usage:

       @Singleton
       class CustomsConfigService @Inject()(configValidationNel: ConfigValidationNelAdaptor) {
         private val root = configValidationNel.root
         private val validatedCustomsEnrolmentConfig: ValidationNel[String, CustomsEnrolmentConfig] = (
           root.string("customs.enrolment.name") |@|
           root.string("customs.enrolment.eori-identifier")
         )(CustomsEnrolmentConfig.apply)
       ...
       }

   Annotations
     @Singleton()

2. #### class CustomsErrorHandler extends DefaultHttpErrorHandler with AcceptExtractors

   Annotations
     @Singleton()

3. #### class InvalidEnvironmentException extends RuntimeException

4. #### case class ServiceConfig(url: String, bearerToken: Option[String], environment: String) extends Product with Serializable

5. #### class ServiceConfigProvider extends AnyRef

   Annotations
     @Singleton()

6. #### class ServicesConfig extends play.config.ServicesConfig

   Annotations
     @Singleton()

### Ungrouped