Skip to content

Commit 9e2b780

Browse files
committed
added handlebars support, bumped version up, beginning of acme page script support for acme page
1 parent f064c96 commit 9e2b780

File tree

13 files changed

+1057
-9
lines changed

13 files changed

+1057
-9
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,6 @@ certs/**/*
137137

138138
# authentication tokens
139139
auth.json
140+
141+
# script to modify the configuration on development machines
142+
devconf.js

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ An NodeJS version of Nginx Proxy Manager that is hopefully more reliable.
1818
4. Edit the `config.json` with the editor of your choice
1919
5. Run the application: `node index.js`
2020

21+
### Updating from Git
22+
23+
During updates, often config changes are shipped to keep your config compatible, most features are non breaking.
24+
25+
To update it without many issues:
26+
1. stash local changes: `git add * && git stash`
27+
2. update local clone: `git pull`
28+
3. pop stash: `git stash pop`
29+
4. check the config with a editor of your choice for any merge conflicts and resolve them
30+
2131
### Autostart using PM2 (Linux/MacOS only I believe)
2232

2333
> This short guide assumes you have fully followed through the Installation steps.

acme.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { readdir, readFile } from 'fs/promises';
33
import { createServer as createServerHttp, IncomingMessage, ServerResponse } from 'http';
44
import { join, resolve, dirname } from 'path';
55
import { fileURLToPath } from 'url';
6+
import { hostname } from 'os';
67

78
import config from './config.json' with {
89
type: "json"
@@ -19,6 +20,16 @@ const http01 = http01Lib.create({});
1920
const __filename = fileURLToPath(import.meta.url);
2021
const __dirname = dirname(__filename);
2122

23+
if (hostname() == "devserv.ht-dev.de") {
24+
config.acme.staging = true;
25+
config.acme.email = "noreply@ht-dev.de";
26+
config.acme.domains = config.acme.domains.filter(domains => domains[0] !== "example.com");
27+
if (config.acme.domains.length == 0) {
28+
config.acme.domains = [["devserv.ht-dev.de"]];
29+
}
30+
config.acme.agreeToTerms = true;
31+
}
32+
2233
export function runCertbot() {
2334
const greenlock = Greenlock.create({
2435
staging: config.acme.staging,
@@ -49,6 +60,16 @@ export function runCertbot() {
4960

5061
config.acme.domains.forEach(domains => {
5162
console.log(`Processing domain: ${domains[0]}`);
63+
if (domains[0] == "example.com") {
64+
console.warn("Skipping example.com domain");
65+
return;
66+
} else if(domains[0] == "devserv.ht-dev.de" && hostname() != "devserv.ht-dev.de") {
67+
// this is the development server and should never appear on anyones configuration
68+
throw new Error("Invalid Configuration!");
69+
} else if(domains[0] == "localhost") {
70+
console.warn("Skipping localhost domain");
71+
return;
72+
}
5273
greenlock.add({
5374
subject: domains[0],
5475
altnames: domains,

config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@
4848
},
4949
"acme": {
5050
"_note": "this client does not seem too reliable, use certbot or acme.sh instead if possible",
51-
"enabled": false,
51+
"enabled": true,
5252
"_terms": "From the directory link, you will find the terms of service, you need to agree to them before using the acme client",
5353
"agreeToTerms": false,
5454
"directoryUrl": "https://acme-v02.api.letsencrypt.org/directory",
55+
"_configDir": "do not change this unless you know what you are doing",
5556
"configDir": "certs/acme",
5657
"_email": "change this to your email address",
5758
"email": "changme@example.com",

0 commit comments

Comments
 (0)