chore: full implementation of code review recommendations (security, quality, tests)

This commit is contained in:
ralksta
2026-03-07 09:27:47 +01:00
parent 6f4b441bd6
commit 280c5430ca
13 changed files with 240 additions and 41 deletions

View File

@@ -29,10 +29,25 @@ const envSchema = z.object({
/**
* Secret used for signing auth cookies and encrypting asset tokens.
* If not provided, IMMICH_API_KEY will be used as a fallback (not recommended for production).
*/
AUTH_SECRET: z.string().min(16, 'AUTH_SECRET should be at least 16 characters').optional(),
});
}).refine(
(data) => {
// Only require AUTH_SECRET in production at runtime, not during build
if (
process.env.NODE_ENV === 'production' &&
!process.env.NEXT_PHASE?.includes('build') &&
!data.AUTH_SECRET
) {
return false;
}
return true;
},
{
message: 'AUTH_SECRET is required in production',
path: ['AUTH_SECRET'],
},
);
export type Env = z.infer<typeof envSchema>;