-
For specifying an oauth redirect path I'd like to know the hostname and port inside a route handler. In this case in another file so I can't reference The only way I found so far is: import Elysia from 'elysia'
// .use(serverInfo)
export const serverInfo = () => {
const app = new Elysia({
name: 'app:serverInfo',
}).derive(() => {
return {
hostname: app.server?.hostname || '',
port: app.server?.port || '',
}
}) as Elysia<
'',
false,
{
decorator: {}
store: {}
derive: {}
resolve: {}
},
{
type: {}
error: {}
},
{
schema: {}
macro: {}
},
{},
{
derive: {}
resolve: {}
schema: {}
},
{
derive: {
readonly hostname: ''
readonly port: ''
}
resolve: {}
schema: {}
}
>
return app
} Which I'm mostly satisfied with but since the handler has to refer to It would of course be a lot easier if the handlers had
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think I'm overcooking this and I'll just have an env var for oauth redirect |
Beta Was this translation helpful? Give feedback.
I think I'm overcooking this and I'll just have an env var for oauth redirect