28 lines
		
	
	
		
			945 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			945 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import dotenv from 'dotenv';
 | |
| 
 | |
| // Load .env first and override existing env vars in DEV to ensure a single source of truth
 | |
| // In Docker, environment variables will be injected at runtime and still be read here.
 | |
| dotenv.config({ override: true });
 | |
| 
 | |
| // Normalize host (prefer explicit MEILI_HOST)
 | |
| export const MEILI_HOST = process.env.MEILI_HOST || 'http://127.0.0.1:7700';
 | |
| 
 | |
| // Single API key resolution
 | |
| export const MEILI_API_KEY = process.env.MEILI_API_KEY || process.env.MEILI_MASTER_KEY || undefined;
 | |
| 
 | |
| // Vault path resolution (default to ./vault)
 | |
| export const VAULT_PATH = process.env.VAULT_PATH || './vault';
 | |
| 
 | |
| // Server port
 | |
| export const PORT = Number(process.env.PORT || 4000);
 | |
| 
 | |
| export function debugPrintConfig(prefix = 'Config') {
 | |
|   console.log(`[${prefix}]`, {
 | |
|     MEILI_HOST,
 | |
|     MEILI_KEY_LENGTH: MEILI_API_KEY?.length,
 | |
|     MEILI_KEY_PREVIEW: MEILI_API_KEY ? `${MEILI_API_KEY.slice(0, 8)}...` : 'none',
 | |
|     VAULT_PATH,
 | |
|     PORT,
 | |
|   });
 | |
| }
 |