• Public
  • Public/Protected
  • All

Class EnvironmentAccessor


  • EnvironmentAccessor



Static getDestinationBasicCredentials

  • getDestinationBasicCredentials(): BasicCredentials
  • Basic Credentials Getter from Destination service credentials needed for JWT generator.

    Returns BasicCredentials


Static getDestinationServiceCredentials

  • getDestinationServiceCredentials(): any
  • First 'destination' credentials getter.

    Returns any

    'destination' credentials object. null: if there is no existing 'destination' credentials

Static getDestinationServiceCredentialsList

  • getDestinationServiceCredentialsList(): DestinationServiceCredentials[]
  • Destination credentials getter.


    list of 'credentials' objects in 'destination' service.

    Returns DestinationServiceCredentials[]

Static getDestinationServiceUri

  • getDestinationServiceUri(): string | null
  • Destination URI getter NOTICE: If there exist more than one destination/uri, the function returns the first entry.


    the first existing uri in destination. null: if no valid destination is found.

    Returns string | null

Static getEnvironmentVariable

  • getEnvironmentVariable(name: string): string | null
  • Environment variables accessor.


    • name: string

      Environment variable name.

    Returns string | null

    Env variable value if defined. null: If not defined.

Static getServiceCredentialsList

  • getServiceCredentialsList(service: string): any[]
  • Credentials list getter for a given service.


    • service: string

    Returns any[]

    Fetched credentials objects of existing service in 'VCAP_SERVICES'.

Static getServiceList

  • getServiceList(service: string): any[]
  • Services getter for a given service.


    • service: string

      Service name.

    Returns any[]

    List of service bindings of the given type. Returns an empty array if no service binding exists for the given type.

Static getVcapService

  • getVcapService(): MapType<any> | null
  • 'VCAP_SERVICES' Getter from environment variables. This function returns the VCAP_SERVICES as object or null if it is not defined (i.e. no services are bound to the application).


    'VCAP_SERVICES' found in environment variables or null if not defined. The key denotes the name ov the service and the value is the definition.

    Returns MapType<any> | null

Static getXsuaaServiceCredentials

  • getXsuaaServiceCredentials(decodedJwt?: MapType<any>): XsuaaServiceCredentials | null
  • Takes a decoded JWT and uses the client_id and audience claims to determine the XSUAA service instance that issued the JWT. Returns the credentials if a match is found otherwise returns null. If no decoded JWT is specified, then returns the first existing XSUAA credential service plan "application".


    • Optional decodedJwt: MapType<any>

      A decoded JWT.

    Returns XsuaaServiceCredentials | null

    The credentials for a match, otherwise null.