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