fix docker build
This commit is contained in:
@@ -44,9 +44,10 @@ declare module "next-auth" {
|
|||||||
* Auth providers
|
* Auth providers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const providers: Provider[] = [];
|
function getProviders() {
|
||||||
|
const providers: Provider[] = [];
|
||||||
|
|
||||||
if (env.GITHUB_ID && env.GITHUB_SECRET) {
|
if (env.GITHUB_ID && env.GITHUB_SECRET) {
|
||||||
providers.push(
|
providers.push(
|
||||||
GitHubProvider({
|
GitHubProvider({
|
||||||
clientId: env.GITHUB_ID,
|
clientId: env.GITHUB_ID,
|
||||||
@@ -54,9 +55,9 @@ if (env.GITHUB_ID && env.GITHUB_SECRET) {
|
|||||||
allowDangerousEmailAccountLinking: true,
|
allowDangerousEmailAccountLinking: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (env.GOOGLE_CLIENT_ID && env.GOOGLE_CLIENT_SECRET) {
|
if (env.GOOGLE_CLIENT_ID && env.GOOGLE_CLIENT_SECRET) {
|
||||||
providers.push(
|
providers.push(
|
||||||
GoogleProvider({
|
GoogleProvider({
|
||||||
clientId: env.GOOGLE_CLIENT_ID,
|
clientId: env.GOOGLE_CLIENT_ID,
|
||||||
@@ -64,9 +65,9 @@ if (env.GOOGLE_CLIENT_ID && env.GOOGLE_CLIENT_SECRET) {
|
|||||||
allowDangerousEmailAccountLinking: true,
|
allowDangerousEmailAccountLinking: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (env.FROM_EMAIL) {
|
if (env.FROM_EMAIL) {
|
||||||
providers.push(
|
providers.push(
|
||||||
EmailProvider({
|
EmailProvider({
|
||||||
from: env.FROM_EMAIL,
|
from: env.FROM_EMAIL,
|
||||||
@@ -78,10 +79,13 @@ if (env.FROM_EMAIL) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (providers.length === 0) {
|
if (providers.length === 0 && process.env.SKIP_ENV_VALIDATION !== "true") {
|
||||||
throw new Error("No auth providers found, need atleast one");
|
throw new Error("No auth providers found, need atleast one");
|
||||||
|
}
|
||||||
|
|
||||||
|
return providers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,7 +120,7 @@ export const authOptions: NextAuthOptions = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
providers,
|
providers: getProviders(),
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user