update example

This commit is contained in:
AJ ONeal 2016-04-18 16:32:21 +00:00
parent 6b4b19a84f
commit b9bde1d6dc
1 changed files with 12 additions and 6 deletions

View File

@ -6,21 +6,27 @@
/* Note: using staging server url, remove .testing() for production
Using .testing() will overwrite the debug flag with true */
var LEX = require('../').testing();
var LEX = require('letsencrypt-express').testing();
var http = require('http');
// NOTE: you could use the old https module if for some reason
// you don't want to support modern browsers
var https = require('spdy');
var leConfDir = require('os').homedir() + '/letsencrypt/etc';
throw new Error(
"You must edit the example to change the email address (and remove this error)."
+ " Also, you'll need to remove .testing() and rm -rf '" + leConfDir + "'"
+ " to get actual, trusted production certificates.");
var lex = LEX.create({
configDir: require('os').homedir() + '/letsencrypt/etc'
configDir: leConfDir
, approveRegistration: function (hostname, cb) { // leave `null` to disable automatic registration
// Note: this is the place to check your database to get the user associated with this domain
cb(null, {
domains: [hostname]
, email: 'aj@daplie.com' // user@example.com
, email: 'CHANGE_ME' // user@example.com
, agreeTos: true
});
}
});
var http = require('http');
var https = require('spdy');
// NOTE: you could use the old https module if for some reason you don't want to support modern browsers
function redirectHttp() {
http.createServer(LEX.createAcmeResponder(lex, function redirectHttps(req, res) {