index.js
function loadWithCallback (options, callback) {
  const endpoint = options.endpoint ? URL.parse(options.endpoint) : DEFAULT_URL
  const name = options.name || options.application
  const context = options.context
  const client = endpoint.protocol === 'https:' ? https : http

  client.request({
    protocol: endpoint.protocol,
    hostname: endpoint.hostname,
    port: endpoint.port,
    path: getPath(endpoint.path, name, options.profiles, options.label),
    auth: getAuth(options.auth, endpoint),
    rejectUnauthorized: options.rejectUnauthorized !== false,
    agent: options.agent
  }, (res) => {
    if (res.statusCode !== 200) { // OK
      res.resume() // it consumes response
      return callback(new Error('Invalid response: ' + res.statusCode))
    }
    let response = ''
    res.setEncoding('utf8')
    res.on('data', (data) => {
      response += data
    })
    res.on('end', () => {
      try {
        const body = JSON.parse(response)
        callback(null, new Config(body, context))
      } catch (e) {
        callback(e)
      }
    })
  }).on('error', callback).end()
}
function loadWithCallback (options, callback) {
  const endpoint = options.endpoint ? URL.parse(options.endpoint) : DEFAULT_URL
  const name = options.name || options.application
  const context = options.context
  const client = endpoint.protocol === 'https:' ? https : http

  client.request({
    protocol: endpoint.protocol,
    hostname: endpoint.hostname,
    port: endpoint.port,
    path: getPath(endpoint.path, name, options.profiles, options.label),
    auth: getAuth(options.auth, endpoint),
    rejectUnauthorized: options.rejectUnauthorized !== false,
    agent: options.agent
  }, (res) => {
    if (res.statusCode !== 200) { // OK
      res.resume() // it consumes response
      return callback(new Error('Invalid response: ' + res.statusCode))
    }
    let response = ''
    res.setEncoding('utf8')
    res.on('data', (data) => {
      response += data
    })
    res.on('end', () => {
      try {
        const body = JSON.parse(response)
        callback(null, new Config(body, context))
      } catch (e) {
        callback(e)
      }
    })
  }).on('error', callback).end()
}
function loadWithCallback ( options , callback ) { const endpoint = options . endpoint ? URL . parse ( options . endpoint ) : DEFAULT_URL const name = options . name || options . application const context = options . context const client = endpoint . protocol === 'https:' ? https : http client . request ( { protocol : endpoint . protocol , hostname : endpoint . hostname , port : endpoint . port , path : getPath ( endpoint . path , name , options . profiles , options . label ) , auth : getAuth ( options . auth , endpoint ) , rejectUnauthorized : options . rejectUnauthorized !== false , agent : options . agent } , ( res ) => { if ( res . statusCode !== 200 ) { // OK res . resume ( ) // it consumes response return callback ( new Error ( 'Invalid response: ' + res . statusCode ) ) } let response = '' res . setEncoding ( 'utf8' ) res . on ( 'data' , ( data ) => { response += data } ) res . on ( 'end' , ( ) => { try { const body = JSON . parse ( response ) callback ( null , new Config ( body , context ) ) } catch ( e ) { callback ( e ) } } ) } ) . on ( 'error' , callback ) . end ( ) }
Load configuration with callback

@param {module:CloudConfigClient~Options} options - spring client configuration options
@param {module:CloudConfigClient~loadCallback} [callback] - load callback
Load configuration with callback