chore(frontend): update .dockerignore and .gitignore to correct lib directory entry; add new utility and file handling modules
This commit is contained in:
15
frontend/lib/env.ts
Normal file
15
frontend/lib/env.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { env } from 'next-runtime-env';
|
||||
|
||||
export const getEnv = (key: string, defaultValue?: string): string => {
|
||||
try {
|
||||
const value = env(key);
|
||||
return value || defaultValue || '';
|
||||
} catch (error) {
|
||||
console.error(`Error getting environment variable ${key}:`, error);
|
||||
return defaultValue || '';
|
||||
}
|
||||
};
|
||||
|
||||
export const getApiUrl = (): string => {
|
||||
return getEnv('NEXT_PUBLIC_API_URL', 'https://api-evoai.evoapicloud.com');
|
||||
};
|
||||
Reference in New Issue
Block a user