mirror of
				https://github.com/therootcompany/greenlock.js.git
				synced 2024-11-16 17:29:00 +00:00 
			
		
		
		
	needRegistration callback
This commit is contained in:
		
							parent
							
								
									9f3e122156
								
							
						
					
					
						commit
						be254c087f
					
				
							
								
								
									
										31
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								index.js
									
									
									
									
									
								
							| @ -50,6 +50,10 @@ module.exports.create = function (letsencrypt, defaults, options) { | ||||
|     return copy; | ||||
|   } | ||||
| 
 | ||||
|   function isCurrent(cache) { | ||||
|     return cache; | ||||
|   } | ||||
| 
 | ||||
|   function sniCallback(hostname, cb) { | ||||
|     var args = merge({}); | ||||
|     args.domains = [hostname]; | ||||
| @ -59,15 +63,26 @@ module.exports.create = function (letsencrypt, defaults, options) { | ||||
|         return; | ||||
|       } | ||||
| 
 | ||||
|       if (!cache.context) { | ||||
|         cache.context = tls.createSecureContext({ | ||||
|           key: cache.key    // privkey.pem
 | ||||
|         , cert: cache.cert  // fullchain.pem
 | ||||
|         //, ciphers         // node's defaults are great
 | ||||
|         }); | ||||
|       function respond(c2) { | ||||
|         cache = c2 || cache; | ||||
| 
 | ||||
|         if (!cache.context) { | ||||
|           cache.context = tls.createSecureContext({ | ||||
|             key: cache.key    // privkey.pem
 | ||||
|           , cert: cache.cert  // fullchain.pem
 | ||||
|           //, ciphers         // node's defaults are great
 | ||||
|           }); | ||||
|         } | ||||
|          | ||||
|         cb(null, cache.context); | ||||
|       } | ||||
|        | ||||
|       cb(null, cache.context); | ||||
| 
 | ||||
|       if (isCurrent(cache)) { | ||||
|         respond(); | ||||
|         return; | ||||
|       } | ||||
| 
 | ||||
|       defaults.needsRegistration(hostname, respond); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user