uk.gov.hmrc.customs.api.common

# config

#### package config

Linear Supertypes
AnyRef, Any
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. config
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Type Members

1. #### class ConfigValidatedNelAdaptor 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 `ValidatedNel` class in the `cats` library gives a type that allows us aggregate errors OR apply valid results to a function (such as a case class constructor). It's declaration is `type ValidatedNel[+E, +A] = Validated[NonEmptyList[E], A]` `Nel` is short for `NonEmptyList` which is simply a `List` that is guaranteed to contain at least 1 item.

   Example usage:

       // you will need this import for mapN
       import cats.implicits._

       @Singleton
       class CustomsConfigService @Inject()(configValidatedNel: ConfigValidatedNelAdaptor) {
         private val root = configValidatedNel.root
         private val validatedCustomsEnrolmentConfig: ValidatedNel[String, CustomsEnrolmentConfig] = (
           root.string("customs.enrolment.name"),
           root.string("customs.enrolment.eori-identifier")
         ).mapN(CustomsEnrolmentConfig)
       ...
       }

   Note that the `ValidatedNel` behaviour is derived from it being an Applicative Functor (see https://typelevel.org/cats/typeclasses/applicative.html)

   Annotations
     @Singleton()

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

   Annotations
     @Singleton()

3. #### type CustomsValidatedNel[A] = Validated[NonEmptyList[String], A]

4. #### class InvalidEnvironmentException extends RuntimeException

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

6. #### class ServiceConfigProvider extends AnyRef

   Annotations
     @Singleton()

### Inherited from AnyRef

### Inherited from Any

### Ungrouped