| 
									
										
										
										
											2017-02-06 20:40:28 +02:00
										 |  |  | // Functions
 | 
					
						
							| 
									
										
										
										
											2017-02-27 21:04:43 +02:00
										 |  |  | export const assertNotMissingOrEmpty = (name: string, value: string | null | undefined) => { | 
					
						
							|  |  |  |   if (!value) { | 
					
						
							|  |  |  |     throw new Error(`Missing or empty required parameter '${name}'!`); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-06 20:40:28 +02:00
										 |  |  | export const getEnvVar = (name: string, isOptional = false): string => { | 
					
						
							|  |  |  |   const value = process.env[name]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (!isOptional && !value) { | 
					
						
							|  |  |  |     console.error(`ERROR: Missing required environment variable '${name}'!`); | 
					
						
							|  |  |  |     process.exit(1); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return value || ''; | 
					
						
							|  |  |  | }; |