octopus-deploy
Version:
Node scripts to package up applications, create releases, and deploy with Octopus Deploy. This package leverages the Octopus Deploy REST API in order to deploy from Windows and non-Windows machines.
37 lines (28 loc) • 610 B
JavaScript
let clientConfig = null
const getApiConfig = () => {
if (!clientConfig) {
throw new Error('client config has not been set')
}
return clientConfig
}
const setApiConfig = config => {
const requiredConfig = ['host', 'apiKey']
if (!config) {
throw new Error('client config is required')
}
for (const key of requiredConfig) {
if (!config[key]) {
throw new Error(`${key} is required in client config`)
}
}
clientConfig = config
}
const clearApiConfig = () => {
clientConfig = null
}
module.exports = {
clearApiConfig,
getApiConfig,
setApiConfig
}