| 
									
										
										
										
											2016-08-11 22:55:26 -04:00
										 |  |  | 'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var cluster = require('cluster'); | 
					
						
							|  |  |  | var main; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // You'll often see examples where people use cluster
 | 
					
						
							|  |  |  | // master and worker all in the same file, which is fine,
 | 
					
						
							|  |  |  | // but in order to conserve memory and especially to be
 | 
					
						
							|  |  |  | // less confusing, I'm splitting the code into two files
 | 
					
						
							|  |  |  | if (cluster.isMaster) { | 
					
						
							|  |  |  |   main = require('./master'); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | else { | 
					
						
							|  |  |  |   main = require('./worker'); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-25 14:53:56 -07:00
										 |  |  | // this is nothing greenlock-cluster specific
 | 
					
						
							| 
									
										
										
										
											2016-08-11 22:55:26 -04:00
										 |  |  | // I'm just arbitrarily choosing to share some configuration
 | 
					
						
							|  |  |  | // that I know I'm going to use in both places
 | 
					
						
							|  |  |  | main.init({ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Depending on the strategy, the whole le-challenge-<<strategy>>
 | 
					
						
							|  |  |  |   // could be shared between worker and server, but since I'm just
 | 
					
						
							|  |  |  |   // using using le-challenge-fs (as you'll see), I'm only sharing the webrootPath
 | 
					
						
							|  |  |  |   webrootPath: require('os').tmpdir() + require('path').sep + 'acme-challenge' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-25 14:53:56 -07:00
										 |  |  |   // this is used both by node-greenlock (master) and le-sni-auto (worker)
 | 
					
						
							| 
									
										
										
										
											2016-08-11 22:55:26 -04:00
										 |  |  | , renewWithin: 15 * 24 * 60 * 60 * 1000 | 
					
						
							|  |  |  | }); |