How to use the @adobe/aio-lib-core-config.get function in @adobe/aio-lib-core-config

To help you get started, we’ve selected a few @adobe/aio-lib-core-config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adobe / aio-cli-plugin-runtime / src / commands / runtime / property / get.js View on Github external
const apiVersion = process.env[PropertyEnv.APIVERSION] || config.get('runtime.apiversion') || properties.get(PropertyKey.APIVERSION) || PropertyDefault.APIVERSION
    if (flags.all || flags.apiversion) {
      data.push({ Property: PropertyGet.flags.apiversion.description, Value: apiVersion })
    }

    const cert = config.get('runtime.cert') || properties.get(PropertyKey.CERT) || PropertyDefault.CERT
    if (flags.all || flags.cert) {
      data.push({ Property: PropertyGet.flags.cert.description, Value: cert })
    }

    const key = config.get('runtime.key') || properties.get(PropertyKey.KEY) || PropertyDefault.KEY
    if (flags.all || flags.key) {
      data.push({ Property: PropertyGet.flags.key.description, Value: key })
    }

    const namespace = process.env[PropertyEnv.NAMESPACE] || config.get('runtime.namespace') || properties.get(PropertyKey.NAMESPACE) || PropertyDefault.NAMESPACE
    if (flags.all || flags.namespace) {
      data.push({ Property: PropertyGet.flags.namespace.description, Value: namespace })
    }

    if (flags.all || flags.cliversion) {
      data.push({ Property: PropertyGet.flags.cliversion.description, Value: this.config.userAgent })
    }

    // to get apibuild and apibuildno, we need to do a server call
    if (flags.all || flags.apibuild || flags.apibuildno) {
      const uri = `${apiHost}/api/${apiVersion}`

      let result = { build: 'error', buildno: 'error' }

      try {
        debug(`Getting data from url ${uri} ...\n`)
github adobe / aio-cli-plugin-runtime / src / RuntimeBaseCommand.js View on Github external
async wsk () {
    const { flags } = this.parse(this.constructor)
    const properties = propertiesFile()

    const options = {
      cert: flags.cert || config.get('runtime.cert') || properties.get('CERT'),
      key: flags.key || config.get('runtime.key') || properties.get('KEY'),
      apiversion: flags.apiversion || config.get('runtime.apiversion') || properties.get('APIVERSION') || PropertyDefault.APIVERSION,
      apihost: flags.apihost || config.get('runtime.apihost') || properties.get('APIHOST') || PropertyDefault.APIHOST,
      namespace: config.get('runtime.namespace') || properties.get('NAMESPACE'),
      api_key: flags.auth || config.get('runtime.auth') || properties.get('AUTH'),
      ignore_certs: flags.insecure || config.get('runtime.insecure')
    }

    // remove any null or undefined keys
    Object
      .keys(options)
      .forEach((key) => {
        if (options[key] === null || options[key] === undefined) {
          delete options[key]
        }
      })
github adobe / aio-cli-plugin-runtime / src / RuntimeBaseCommand.js View on Github external
async wsk () {
    const { flags } = this.parse(this.constructor)
    const properties = propertiesFile()

    const options = {
      cert: flags.cert || config.get('runtime.cert') || properties.get('CERT'),
      key: flags.key || config.get('runtime.key') || properties.get('KEY'),
      apiversion: flags.apiversion || config.get('runtime.apiversion') || properties.get('APIVERSION') || PropertyDefault.APIVERSION,
      apihost: flags.apihost || config.get('runtime.apihost') || properties.get('APIHOST') || PropertyDefault.APIHOST,
      namespace: config.get('runtime.namespace') || properties.get('NAMESPACE'),
      api_key: flags.auth || config.get('runtime.auth') || properties.get('AUTH'),
      ignore_certs: flags.insecure || config.get('runtime.insecure')
    }

    // remove any null or undefined keys
    Object
      .keys(options)
      .forEach((key) => {
        if (options[key] === null || options[key] === undefined) {
          delete options[key]
        }
      })

    debug(options)

    if (!(options.apihost).toString().trim()) {
      throw new Error('An API host must be specified')
    }
github adobe / aio-cli-plugin-runtime / src / commands / runtime / property / get.js View on Github external
const data = []
    const properties = propertiesFile()

    // get property data
    const auth = process.env[PropertyEnv.AUTH] || config.get('runtime.auth') || properties.get(PropertyKey.AUTH) || PropertyDefault.AUTH
    if (flags.all || flags.auth) {
      data.push({ Property: PropertyGet.flags.auth.description, Value: auth })
    }

    const apiHost = process.env[PropertyEnv.APIHOST] || config.get('runtime.apihost') || properties.get(PropertyKey.APIHOST) || PropertyDefault.APIHOST
    if (flags.all || flags.apihost) {
      data.push({ Property: PropertyGet.flags.apihost.description, Value: apiHost })
    }

    const apiVersion = process.env[PropertyEnv.APIVERSION] || config.get('runtime.apiversion') || properties.get(PropertyKey.APIVERSION) || PropertyDefault.APIVERSION
    if (flags.all || flags.apiversion) {
      data.push({ Property: PropertyGet.flags.apiversion.description, Value: apiVersion })
    }

    const cert = config.get('runtime.cert') || properties.get(PropertyKey.CERT) || PropertyDefault.CERT
    if (flags.all || flags.cert) {
      data.push({ Property: PropertyGet.flags.cert.description, Value: cert })
    }

    const key = config.get('runtime.key') || properties.get(PropertyKey.KEY) || PropertyDefault.KEY
    if (flags.all || flags.key) {
      data.push({ Property: PropertyGet.flags.key.description, Value: key })
    }

    const namespace = process.env[PropertyEnv.NAMESPACE] || config.get('runtime.namespace') || properties.get(PropertyKey.NAMESPACE) || PropertyDefault.NAMESPACE
    if (flags.all || flags.namespace) {
github adobe / aio-cli-plugin-runtime / src / RuntimeBaseCommand.js View on Github external
async wsk () {
    const { flags } = this.parse(this.constructor)
    const properties = propertiesFile()

    const options = {
      cert: flags.cert || config.get('runtime.cert') || properties.get('CERT'),
      key: flags.key || config.get('runtime.key') || properties.get('KEY'),
      apiversion: flags.apiversion || config.get('runtime.apiversion') || properties.get('APIVERSION') || PropertyDefault.APIVERSION,
      apihost: flags.apihost || config.get('runtime.apihost') || properties.get('APIHOST') || PropertyDefault.APIHOST,
      namespace: config.get('runtime.namespace') || properties.get('NAMESPACE'),
      api_key: flags.auth || config.get('runtime.auth') || properties.get('AUTH'),
      ignore_certs: flags.insecure || config.get('runtime.insecure')
    }

    // remove any null or undefined keys
    Object
      .keys(options)
      .forEach((key) => {
        if (options[key] === null || options[key] === undefined) {
          delete options[key]
        }
      })
github adobe / aio-cli-plugin-runtime / src / RuntimeBaseCommand.js View on Github external
async wsk () {
    const { flags } = this.parse(this.constructor)
    const properties = propertiesFile()

    const options = {
      cert: flags.cert || config.get('runtime.cert') || properties.get('CERT'),
      key: flags.key || config.get('runtime.key') || properties.get('KEY'),
      apiversion: flags.apiversion || config.get('runtime.apiversion') || properties.get('APIVERSION') || PropertyDefault.APIVERSION,
      apihost: flags.apihost || config.get('runtime.apihost') || properties.get('APIHOST') || PropertyDefault.APIHOST,
      namespace: config.get('runtime.namespace') || properties.get('NAMESPACE'),
      api_key: flags.auth || config.get('runtime.auth') || properties.get('AUTH'),
      ignore_certs: flags.insecure || config.get('runtime.insecure')
    }

    // remove any null or undefined keys
    Object
      .keys(options)
      .forEach((key) => {
        if (options[key] === null || options[key] === undefined) {
          delete options[key]
        }
      })

    debug(options)

    if (!(options.apihost).toString().trim()) {
github adobe / aio-cli-plugin-runtime / src / RuntimeBaseCommand.js View on Github external
async wsk () {
    const { flags } = this.parse(this.constructor)
    const properties = propertiesFile()

    const options = {
      cert: flags.cert || config.get('runtime.cert') || properties.get('CERT'),
      key: flags.key || config.get('runtime.key') || properties.get('KEY'),
      apiversion: flags.apiversion || config.get('runtime.apiversion') || properties.get('APIVERSION') || PropertyDefault.APIVERSION,
      apihost: flags.apihost || config.get('runtime.apihost') || properties.get('APIHOST') || PropertyDefault.APIHOST,
      namespace: config.get('runtime.namespace') || properties.get('NAMESPACE'),
      api_key: flags.auth || config.get('runtime.auth') || properties.get('AUTH'),
      ignore_certs: flags.insecure || config.get('runtime.insecure')
    }

    // remove any null or undefined keys
    Object
      .keys(options)
      .forEach((key) => {
        if (options[key] === null || options[key] === undefined) {
          delete options[key]
        }
      })

    debug(options)
github adobe / aio-cli-plugin-runtime / src / RuntimeBaseCommand.js View on Github external
async wsk () {
    const { flags } = this.parse(this.constructor)
    const properties = propertiesFile()

    const options = {
      cert: flags.cert || config.get('runtime.cert') || properties.get('CERT'),
      key: flags.key || config.get('runtime.key') || properties.get('KEY'),
      apiversion: flags.apiversion || config.get('runtime.apiversion') || properties.get('APIVERSION') || PropertyDefault.APIVERSION,
      apihost: flags.apihost || config.get('runtime.apihost') || properties.get('APIHOST') || PropertyDefault.APIHOST,
      namespace: config.get('runtime.namespace') || properties.get('NAMESPACE'),
      api_key: flags.auth || config.get('runtime.auth') || properties.get('AUTH'),
      ignore_certs: flags.insecure || config.get('runtime.insecure')
    }

    // remove any null or undefined keys
    Object
      .keys(options)
      .forEach((key) => {
        if (options[key] === null || options[key] === undefined) {
          delete options[key]
        }
      })

    debug(options)
github adobe / aio-cli-plugin-runtime / src / properties.js View on Github external
function propertiesFile () {
  let properties = { get: () => null }
  const wskConfigFile = process.env[PropertyEnv.CONFIG_FILE] || config.get('runtime.config_file') || PropertyDefault.CONFIG_FILE

  if (fs.existsSync(wskConfigFile)) {
    properties = PropertiesReader(wskConfigFile)
  }

  properties.save = function () {
    const saved = []
    this.each((key, val) => saved.push(`${key}=${val}`))

    fs.writeFileSync(wskConfigFile, saved.join('\n'))
  }

  return properties
}
github adobe / aio-cli-plugin-runtime / src / commands / runtime / property / get.js View on Github external
const auth = process.env[PropertyEnv.AUTH] || config.get('runtime.auth') || properties.get(PropertyKey.AUTH) || PropertyDefault.AUTH
    if (flags.all || flags.auth) {
      data.push({ Property: PropertyGet.flags.auth.description, Value: auth })
    }

    const apiHost = process.env[PropertyEnv.APIHOST] || config.get('runtime.apihost') || properties.get(PropertyKey.APIHOST) || PropertyDefault.APIHOST
    if (flags.all || flags.apihost) {
      data.push({ Property: PropertyGet.flags.apihost.description, Value: apiHost })
    }

    const apiVersion = process.env[PropertyEnv.APIVERSION] || config.get('runtime.apiversion') || properties.get(PropertyKey.APIVERSION) || PropertyDefault.APIVERSION
    if (flags.all || flags.apiversion) {
      data.push({ Property: PropertyGet.flags.apiversion.description, Value: apiVersion })
    }

    const cert = config.get('runtime.cert') || properties.get(PropertyKey.CERT) || PropertyDefault.CERT
    if (flags.all || flags.cert) {
      data.push({ Property: PropertyGet.flags.cert.description, Value: cert })
    }

    const key = config.get('runtime.key') || properties.get(PropertyKey.KEY) || PropertyDefault.KEY
    if (flags.all || flags.key) {
      data.push({ Property: PropertyGet.flags.key.description, Value: key })
    }

    const namespace = process.env[PropertyEnv.NAMESPACE] || config.get('runtime.namespace') || properties.get(PropertyKey.NAMESPACE) || PropertyDefault.NAMESPACE
    if (flags.all || flags.namespace) {
      data.push({ Property: PropertyGet.flags.namespace.description, Value: namespace })
    }

    if (flags.all || flags.cliversion) {
      data.push({ Property: PropertyGet.flags.cliversion.description, Value: this.config.userAgent })

@adobe/aio-lib-core-config

Adobe I/O Configuration Module

Apache-2.0
Latest version published 7 months ago

Package Health Score

73 / 100
Full package analysis

Popular @adobe/aio-lib-core-config functions

Similar packages