You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			21 lines
		
	
	
		
			610 B
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			21 lines
		
	
	
		
			610 B
		
	
	
	
		
			TypeScript
		
	
import path from 'path';
 | 
						|
import { fileURLToPath } from 'url';
 | 
						|
import dotenv from 'dotenv';
 | 
						|
 | 
						|
/** ES modules cannot use `__dirname`, so we have to mimic its functionality.
 | 
						|
 *  Taken from [https://flaviocopes.com/fix-dirname-not-defined-es-module-scope/]
 | 
						|
 */
 | 
						|
const __filename = fileURLToPath(import.meta.url);
 | 
						|
const __dirname = path.dirname(__filename);
 | 
						|
 | 
						|
if(process.env.NODE_ENV==="development"){
 | 
						|
  const ret = dotenv.config({ path:`${__dirname}/../.env.development` });
 | 
						|
  if(ret.parsed){
 | 
						|
    console.log("parsed!", process.env)
 | 
						|
  }
 | 
						|
  else{
 | 
						|
    console.log("not parsed ;-(", ret.error)
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
export default null; |