| 
									
										
										
										
											2019-06-23 20:21:40 +02:00
										 |  |  | #!/usr/bin/env node
 | 
					
						
							|  |  |  | 'use strict' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // https://git.rootprojects.org/root/acme-dns-01-test.js
 | 
					
						
							| 
									
										
										
										
											2019-08-30 17:01:38 +03:00
										 |  |  | const tester = require('acme-dns-01-test') | 
					
						
							| 
									
										
										
										
											2019-06-23 20:21:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-30 17:01:38 +03:00
										 |  |  | // Usage: node ./test.js example.com you@example.com key xxxxxxxxx
 | 
					
						
							|  |  |  | // Usage: node ./test.js example.com you@example.com token xxxxxxxxx
 | 
					
						
							|  |  |  | // Usage: node ./test.js example.com you@example.com token xxxxxxxxx yyyyyyy
 | 
					
						
							|  |  |  | const [zone, authEmail, authType, credential, zoneToken] = process.argv.slice(2) | 
					
						
							|  |  |  | const config = { authEmail } | 
					
						
							|  |  |  | switch (authType) { | 
					
						
							|  |  |  |   case 'token': | 
					
						
							| 
									
										
										
										
											2019-08-30 17:37:46 +03:00
										 |  |  |     config.bearerTokens = { list: credential, zone: zoneToken || credential } | 
					
						
							| 
									
										
										
										
											2019-08-30 17:01:38 +03:00
										 |  |  |     break | 
					
						
							|  |  |  |   default: | 
					
						
							|  |  |  |     config.authKey = credential | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | const challenger = require('./index.js').create(config) | 
					
						
							| 
									
										
										
										
											2019-06-23 20:21:40 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | // The dry-run tests can pass on, literally, 'example.com'
 | 
					
						
							|  |  |  | // but the integration tests require that you have control over the domain
 | 
					
						
							|  |  |  | tester | 
					
						
							|  |  |  |   .testZone('dns-01', zone, challenger) | 
					
						
							|  |  |  |   .then(function () { | 
					
						
							|  |  |  |     console.info('PASS', zone) | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  |   .catch(function (e) { | 
					
						
							|  |  |  |     console.info('FAIL', zone) | 
					
						
							|  |  |  |     console.error(e.message) | 
					
						
							|  |  |  |     console.error(e.stack) | 
					
						
							|  |  |  |   }) |