roster-server 1.5.6 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/demo/www/manual.js +1 -1
- package/index.js +4 -3
- package/package.json +1 -1
package/demo/www/manual.js
CHANGED
|
@@ -6,7 +6,7 @@ const roster = new Roster({
|
|
|
6
6
|
email: 'admin@example.com',
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
roster.
|
|
9
|
+
roster.register('example.com', (httpsServer) => {
|
|
10
10
|
return (req, res) => {
|
|
11
11
|
res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
12
12
|
res.end('"Loco de pensar, queriendo entrar en razón, y el corazón tiene razones que la propia razón nunca entenderá."');
|
package/index.js
CHANGED
|
@@ -15,11 +15,13 @@ class Roster {
|
|
|
15
15
|
this.hostname = options.hostname || '0.0.0.0';
|
|
16
16
|
this.filename = options.filename || 'index';
|
|
17
17
|
|
|
18
|
-
const port = options.port
|
|
18
|
+
const port = options.port === undefined ? 443 : options.port;
|
|
19
19
|
if (port === 80) {
|
|
20
20
|
throw new Error('⚠️ Port 80 is reserved for ACME challenge. Please use a different port.');
|
|
21
21
|
}
|
|
22
22
|
this.port = port;
|
|
23
|
+
|
|
24
|
+
this.loadSites();
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
loadSites() {
|
|
@@ -166,7 +168,7 @@ class Roster {
|
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
|
|
169
|
-
|
|
171
|
+
register(domain, requestHandler) {
|
|
170
172
|
if (!domain) {
|
|
171
173
|
throw new Error('Domain is required');
|
|
172
174
|
}
|
|
@@ -188,7 +190,6 @@ class Roster {
|
|
|
188
190
|
}
|
|
189
191
|
|
|
190
192
|
start() {
|
|
191
|
-
this.loadSites();
|
|
192
193
|
this.generateConfigJson();
|
|
193
194
|
|
|
194
195
|
const greenlock = Greenlock.init({
|