Add NEXT_PUBLIC_AUTH_MODES environment variable to Dockerfile and update useAuthModes hook

This commit is contained in:
Stan Girard 2024-05-04 15:21:52 +02:00
parent ae20c5af61
commit 64086b108b
2 changed files with 5 additions and 1 deletions

View File

@ -29,6 +29,7 @@ ARG NEXT_PUBLIC_SUPABASE_URL
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
ARG NEXT_PUBLIC_CMS_URL
ARG NEXT_PUBLIC_FRONTEND_URL
ARG NEXT_PUBLIC_AUTH_MODES # Make sure this is declared here if it influences the build
ENV NEXT_PUBLIC_ENV=$NEXT_PUBLIC_ENV
ENV NEXT_PUBLIC_BACKEND_URL=$NEXT_PUBLIC_BACKEND_URL
@ -36,6 +37,8 @@ ENV NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY
ENV NEXT_PUBLIC_CMS_URL=$NEXT_PUBLIC_CMS_URL
ENV NEXT_PUBLIC_FRONTEND_URL=$NEXT_PUBLIC_FRONTEND_URL
ENV NEXT_PUBLIC_AUTH_MODES=$NEXT_PUBLIC_AUTH_MODES
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry

View File

@ -3,7 +3,8 @@ export const useAuthModes = () => {
const authModes = process.env.NEXT_PUBLIC_AUTH_MODES?.split(",") ?? [
"password",
];
console.log('Environment Variable NEXT_PUBLIC_AUTH_MODES:', process.env.NEXT_PUBLIC_AUTH_MODES);
console.log('authModes:', authModes);
return {
magicLink: authModes.includes("magic_link"),
password: authModes.includes("password"),