| 
									
										
										
										
											2016-11-24 23:21:40 +01: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 = { | 
					
						
							| 
									
										
										
										
											2016-11-24 23:21:40 +01:00
										 |  |  |     alias: 'npmci', | 
					
						
							| 
									
										
										
										
											2016-09-04 13:42:22 +02:00
										 |  |  |     password: servezoneRegexResultArray[3], | 
					
						
							|  |  |  |     port: parseInt(servezoneRegexResultArray[2]), | 
					
						
							| 
									
										
										
										
											2016-11-24 23:21:40 +01:00
										 |  |  |     role: 'ci', | 
					
						
							| 
									
										
										
										
											2016-09-04 13:42:22 +02:00
										 |  |  |     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 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export let run = (configArg) => { | 
					
						
							|  |  |  |     new plugins.smartsocket.SmartsocketClient( | 
					
						
							|  |  |  |         smartsocketClientConstructorOptions | 
					
						
							| 
									
										
										
										
											2016-11-24 23:21:40 +01:00
										 |  |  |     ) | 
					
						
							|  |  |  | } |