mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +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 =>
|
ENCRYPTION_KEY: v =>
|
||||||
(!!v && v.length >= 48) ||
|
(!!v && v.length >= 48) ||
|
||||||
new Error('is required and must be at least 48 characters long; run "npm run keygen" to generate a key'),
|
new Error('is required and must be at least 48 characters long; run "npm run keygen" to generate a key'),
|
||||||
HTTP_EXTERNAL: v =>
|
HTTP_EXTERNAL: v => {
|
||||||
(!!v && v.startsWith('http') && !v.endsWith('/')) ||
|
if (v?.endsWith('/')) {
|
||||||
new Error('must be a valid URL without a trailing slash'),
|
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 =>
|
HTTP_HOST: v =>
|
||||||
(!!v && !v.startsWith('http')) ||
|
(!!v && !v.startsWith('http')) ||
|
||||||
new Error('is required and must be an address, not a URL'),
|
new Error('is required and must be an address, not a URL'),
|
||||||
@ -49,6 +54,7 @@ const load = options => {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
console.log(process.env.HTTP_EXTERNAL);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Loading…
Reference in New Issue
Block a user