mirror of
				https://git.coolaj86.com/coolaj86/greenlock-manager-fs.js.git
				synced 2025-11-04 10:32:47 +00:00 
			
		
		
		
	v0.6.3: support wildname in search
This commit is contained in:
		
							parent
							
								
									c9eb5aef36
								
							
						
					
					
						commit
						0c88e09d7d
					
				
							
								
								
									
										30
									
								
								manager.js
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								manager.js
									
									
									
									
									
								
							@ -180,30 +180,42 @@ Manage.create = function(opts) {
 | 
				
			|||||||
			//args.issuedBefore = Date.now() - 30 * 24 * 60 * 60 * 1000;
 | 
								//args.issuedBefore = Date.now() - 30 * 24 * 60 * 60 * 1000;
 | 
				
			||||||
			// i.e. find certs more that will expire in less than 45 days
 | 
								// i.e. find certs more that will expire in less than 45 days
 | 
				
			||||||
			//args.expiresBefore = Date.now() + 45 * 24 * 60 * 60 * 1000;
 | 
								//args.expiresBefore = Date.now() + 45 * 24 * 60 * 60 * 1000;
 | 
				
			||||||
			var issuedBefore = args.issuedBefore || 0;
 | 
								var issuedBefore = args.issuedBefore || Infinity;
 | 
				
			||||||
			var expiresBefore = args.expiresBefore || Infinity; //Date.now() + 21 * 24 * 60 * 60 * 1000;
 | 
								var expiresBefore = args.expiresBefore || Infinity; //Date.now() + 21 * 24 * 60 * 60 * 1000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			var altnames = (args.altnames || args.domains || []).slice(0);
 | 
								var altnames = (args.altnames || args.domains || []).slice(0);
 | 
				
			||||||
			if (args.servername && !altnames.includes(args.servername)) {
 | 
								if (args.servername && !altnames.includes(args.servername)) {
 | 
				
			||||||
				altnames.push(args.servername);
 | 
									altnames.push(args.servername);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (args.subject && !altnames.includes(args.subject)) {
 | 
								if (args.wildname && !altnames.includes(args.wildname)) {
 | 
				
			||||||
				altnames.push(args.subject);
 | 
									altnames.push(args.wildname);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// TODO match ANY domain on any cert
 | 
								// TODO match ANY domain on any cert
 | 
				
			||||||
			var sites = Object.keys(config.sites || {})
 | 
								var sites = Object.keys(config.sites || {})
 | 
				
			||||||
				.filter(function(sub) {
 | 
									.filter(function(sub) {
 | 
				
			||||||
					var site = config.sites[sub];
 | 
										var site = config.sites[sub];
 | 
				
			||||||
					if (
 | 
										if (site.deletedAt) {
 | 
				
			||||||
						!site.deletedAt ||
 | 
											return false;
 | 
				
			||||||
						site.expiresAt < expiresBefore ||
 | 
										}
 | 
				
			||||||
						site.issuedAt < issuedBefore
 | 
										if (site.expiresAt >= expiresBefore) {
 | 
				
			||||||
					) {
 | 
											return false;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										if (site.issuedAt >= issuedBefore) {
 | 
				
			||||||
 | 
											return false;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										// if subject is specified, don't return anything else
 | 
				
			||||||
 | 
										if (args.subject) {
 | 
				
			||||||
 | 
											if (site.subject === args.subject) {
 | 
				
			||||||
 | 
												return true;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										// altnames, servername, and wildname all get rolled into one
 | 
				
			||||||
					return (site.altnames || []).some(function(name) {
 | 
										return (site.altnames || []).some(function(name) {
 | 
				
			||||||
						return altnames.includes(name);
 | 
											return altnames.includes(name);
 | 
				
			||||||
					});
 | 
										});
 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
				.map(function(name) {
 | 
									.map(function(name) {
 | 
				
			||||||
					var site = config.sites[name];
 | 
										var site = config.sites[name];
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	"name": "greenlock-manager-fs",
 | 
						"name": "greenlock-manager-fs",
 | 
				
			||||||
	"version": "0.6.2",
 | 
						"version": "0.6.3",
 | 
				
			||||||
	"lockfileVersion": 1,
 | 
						"lockfileVersion": 1,
 | 
				
			||||||
	"requires": true,
 | 
						"requires": true,
 | 
				
			||||||
	"dependencies": {
 | 
						"dependencies": {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	"name": "greenlock-manager-fs",
 | 
						"name": "greenlock-manager-fs",
 | 
				
			||||||
	"version": "0.6.2",
 | 
						"version": "0.6.3",
 | 
				
			||||||
	"description": "A simple file-based management strategy for Greenlock",
 | 
						"description": "A simple file-based management strategy for Greenlock",
 | 
				
			||||||
	"main": "manager.js",
 | 
						"main": "manager.js",
 | 
				
			||||||
	"scripts": {
 | 
						"scripts": {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user