@tmlmobilidade/types
Version:
This package provides shared Zod validation schemas and their corresponding TypeScript types for use across projects. All types are automatically inferred from the schemas to ensure full type safety and reduce maintenance overhead.
16 lines (15 loc) • 537 B
JavaScript
/**
* Get the current environment from server-side `ENVIRONMENT`
* or client-side `NEXT_PUBLIC_ENVIRONMET` variables.
* @returns The current environment value.
*/
export function getCurrentEnvironment() {
// Prefer server-side environment variable
if (process.env.ENVIRONMENT)
return process.env.ENVIRONMENT;
// Fallback to client-side environment variable
if (process.env.NEXT_PUBLIC_ENVIRONMENT)
return process.env.NEXT_PUBLIC_ENVIRONMENT;
// Fallback to development
return 'development';
}