origin env

This commit is contained in:
amy 2024-12-03 00:55:24 +03:30
parent ac76ce6988
commit 71266e79f6
Signed by: amy
SSH key fingerprint: SHA256:Y6VEv6ZOxI6zqjjOF4luhfaCoY+zDK0w62P+qhQYie4

View file

@ -17,6 +17,11 @@ if (!process.env.ADMINS) {
process.exit(1);
}
if (!process.env.ORIGIN) {
console.error("no origin found");
process.exit(1);
}
const FILESIZE = process.env.FILESIZE_LIMIT
if (!FILESIZE) {
console.error("no file size detected");
@ -28,10 +33,10 @@ if (!FILESIZE) {
const PORT = process.env.PORT
if (!PORT) {
console.error("no file size detected");
console.error("no port detected");
process.exit(1);
} else if (isNaN(Number(PORT)) && FILESIZE.trim() !== '') {
console.error("file size cannot be parsed.");
console.error("port cannot be parsed.");
process.exit(1);
}
@ -57,7 +62,7 @@ fastify.register(fastifyOauth2, {
},
scope: ["identify"],
startRedirectPath: '/login',
callbackUri: req => `${req.protocol}://${req.host}/login/callback`,
callbackUri: req => `${process.env.ORIGIN}/login/callback`,
})
fastify.get('/login/callback', async function (request, reply) {