flowstate/services/auth.service.ts
Chneemann 1b5a532510
All checks were successful
Deploy Flowstate to VPS / deploy (push) Successful in 48s
fix(auth): support both server and public environment variables for guest credentials service
2026-08-21 17:42:16 +02:00

22 lines
838 B
TypeScript

/**
* @file services/auth.service.ts
* @description Authentication service providing helper functions for retrieving authentication details such as guest credentials from environment variables.
*/
/**
* Retrieves configured guest account credentials from server or public environment variables.
*
* @async
* @returns {Promise<{ email?: string; password?: string; error?: string }>} An object containing the guest email and password, or an error message if unconfigured.
*/
export async function getGuestCredentials() {
const email = process.env.GUEST_EMAIL || process.env.NEXT_PUBLIC_GUEST_EMAIL;
const password =
process.env.GUEST_PASSWORD || process.env.NEXT_PUBLIC_GUEST_PASSWORD;
if (!email || !password) {
return { error: "Guest login is not configured on the server." };
}
return { email, password };
}