merge utils,common -> common

This commit is contained in:
AJ ONeal 2015-12-19 02:18:32 -08:00
parent ce9d19a8b0
commit 46516d5fbb
3 changed files with 18 additions and 21 deletions

View File

@ -107,7 +107,7 @@ LE.create = function (defaults, handlers, backend) {
backend = PromiseA.promisifyAll(backend);
var utils = require('./lib/utils');
var utils = require('./lib/common');
//var attempts = {}; // should exist in master process only
var le;

View File

@ -3,6 +3,23 @@
var fs = require('fs');
var PromiseA = require('bluebird');
var re = /^[a-zA-Z0-9\.\-]+$/;
var punycode = require('punycode');
mudole.exports.isValidDomain = function (domain) {
if (re.test(domain)) {
return domain;
}
domain = punycode.toASCII(domain);
if (re.test(domain)) {
return domain;
}
return '';
};
module.exports.tplConfigDir = function merge(configDir, defaults) {
Object.keys(defaults).forEach(function (key) {
if ('string' === typeof defaults[key]) {

View File

@ -1,20 +0,0 @@
'use strict';
var re = /^[a-zA-Z0-9\.\-]+$/;
var punycode = require('punycode');
var utils = module.exports;
utils.isValidDomain = function (domain) {
if (re.test(domain)) {
return domain;
}
domain = punycode.toASCII(domain);
if (re.test(domain)) {
return domain;
}
return '';
};