mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-22 15:53:08 +02:00
feat: strip trailing slash rather than complaining about it
This commit is contained in:
parent
10c006d659
commit
be6a0459a6
12
src/env.js
12
src/env.js
@ -23,9 +23,14 @@ const env = {
|
||||
ENCRYPTION_KEY: v =>
|
||||
(!!v && v.length >= 48) ||
|
||||
new Error('is required and must be at least 48 characters long; run "npm run keygen" to generate a key'),
|
||||
HTTP_EXTERNAL: v =>
|
||||
(!!v && v.startsWith('http') && !v.endsWith('/')) ||
|
||||
new Error('must be a valid URL without a trailing slash'),
|
||||
HTTP_EXTERNAL: v => {
|
||||
if (v?.endsWith('/')) {
|
||||
v = v.slice(0, -1);
|
||||
process.env.HTTP_EXTERNAL = v;
|
||||
}
|
||||
return (!!v && v.startsWith('http')) ||
|
||||
new Error('must be a valid URL without a trailing slash');
|
||||
},
|
||||
HTTP_HOST: v =>
|
||||
(!!v && !v.startsWith('http')) ||
|
||||
new Error('is required and must be an address, not a URL'),
|
||||
@ -49,6 +54,7 @@ const load = options => {
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
console.log(process.env.HTTP_EXTERNAL);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
Loading…
Reference in New Issue
Block a user