npmci/ts/npmci.servezone.ts

33 lines
884 B
TypeScript
Raw Normal View History

2016-11-24 22:21:40 +00:00
import * as plugins from './npmci.plugins'
/**
* servezoneRegex is the regex that parses the servezone connection data
* parses strings in the form of "servezone.example.com|3000|somepassword"
*/
2016-11-24 22:21:40 +00:00
let servezoneRegex = /^(.*)\|(.*)\|(.*)/
/**
* holds the results of the parsed servezone env string
*/
2016-11-24 22:21:40 +00:00
let servezoneRegexResultArray = servezoneRegex.exec(process.env.NPMCI_SERVEZONE)
/**
* the data object that is used for the smartsocket client object
*/
let smartsocketClientConstructorOptions = {
2016-11-24 22:21:40 +00:00
alias: 'npmci',
password: servezoneRegexResultArray[3],
port: parseInt(servezoneRegexResultArray[2]),
2016-11-24 22:21:40 +00:00
role: 'ci',
url: servezoneRegexResultArray[1]
2016-11-24 22:21:40 +00:00
}
/**
* the main run function to submit a service to a servezone
*/
2017-03-08 13:50:41 +00:00
export let run = async (configArg) => {
new plugins.smartsocket.SmartsocketClient(
smartsocketClientConstructorOptions
2016-11-24 22:21:40 +00:00
)
}