Merge pull request 'Add environment variable to set Onion-Location header' (#28) from Supernova/fork-keyoxide:v2OnionLocation into dev

Reviewed-on: https://codeberg.org/keyoxide/web/pulls/28
This commit is contained in:
Yarmo Mackenbach 2020-08-18 09:33:56 +02:00
commit 30e880e4bb
2 changed files with 13 additions and 0 deletions

View file

@ -36,6 +36,15 @@ md.use(require("markdown-it-anchor"));
md.use(require("markdown-it-table-of-contents"), { "includeLevel": [2, 3], "listType": "ol" });
md.use(require('markdown-it-title'));
if(process.env.ONION_URL)
{
router.get('/*', (req, res, next) => {
res.header('Onion-Location', process.env.ONION_URL);
next();
});
}
router.get('/', (req, res) => {
res.render('index')
});

View file

@ -16,3 +16,7 @@
# Expected format: "XXXXXXXXXXXXXXXXXXXXX"
# If none is provided (default), Twitter accounts are not verified
#TWITTER_API_AUTH=
# Tor Onion URL
# The full http:// onion url to add as an 'Onion-Location' header
#ONION_URL=