mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
21 lines
540 B
TypeScript
21 lines
540 B
TypeScript
import "server-only";
|
|
|
|
import { StackServerApp } from "@stackframe/stack";
|
|
|
|
const authProvider = process.env.NEXT_PUBLIC_AUTH_PROVIDER;
|
|
|
|
function createStackApp() {
|
|
if (authProvider === "local") {
|
|
// Return a dummy object when using local auth to prevent build errors
|
|
return {} as StackServerApp;
|
|
}
|
|
// Only initialize Stack Auth when actually using it
|
|
return new StackServerApp({
|
|
tokenStore: "nextjs-cookie",
|
|
urls: {
|
|
afterSignIn: "/after-sign-in"
|
|
}
|
|
});
|
|
}
|
|
|
|
export const stackServerApp = createStackApp();
|