From 21df3856cf436bfcbd2a4be0e360bcc17e2d04dc Mon Sep 17 00:00:00 2001 From: Ondrej Synacek Date: Tue, 22 Oct 2019 22:26:11 +0200 Subject: [PATCH] add endpoint for LetsEncrypt verification and environment variables --- lib/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/index.js b/lib/index.js index ff25c3d..83267c0 100644 --- a/lib/index.js +++ b/lib/index.js @@ -10,6 +10,8 @@ const generateICS = require('./ics') const { genericErrorHandler, checkURLParameter } = require('./middlewares') const port = process.env.PORT +const certEndpoint = process.env.CERT_ENDPOINT || '' +const certSecret = process.env.CERT_SECRET const app = express() app.set('view engine', 'ejs') @@ -19,6 +21,10 @@ app.use(express.static(path.join(__dirname, 'public'))) app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))) app.use(bodyParser()) +app.get(`/${certEndpoint}`, (req, res) => { + res.status(200).send(certSecret) +}) + app.get('/', (req, res) => { res.render('index') })