origin env
This commit is contained in:
parent
ac76ce6988
commit
71266e79f6
1 changed files with 8 additions and 3 deletions
11
src/main.ts
11
src/main.ts
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue