refactor(config): improve consola error logs
This commit is contained in:
		@@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					import consola from 'consola';
 | 
				
			||||||
import { config as configDotenv } from 'dotenv';
 | 
					import { config as configDotenv } from 'dotenv';
 | 
				
			||||||
import { CountryCode } from 'libphonenumber-js';
 | 
					import { CountryCode } from 'libphonenumber-js';
 | 
				
			||||||
import ValidatorJS from 'validator';
 | 
					import ValidatorJS from 'validator';
 | 
				
			||||||
@@ -20,12 +21,15 @@ export const config = {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
let errors = 0
 | 
					let errors = 0
 | 
				
			||||||
if (typeof config.internal_port !== "number") {
 | 
					if (typeof config.internal_port !== "number") {
 | 
				
			||||||
 | 
					    consola.error("Error: APP_PORT is not a number")
 | 
				
			||||||
    errors++
 | 
					    errors++
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
if (typeof config.development !== "boolean") {
 | 
					if (typeof config.development !== "boolean") {
 | 
				
			||||||
 | 
					    consola.error("Error: NODE_ENV is not a boolean")
 | 
				
			||||||
    errors++
 | 
					    errors++
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
if (config.mailer_url == "" || config.mailer_key == "") {
 | 
					if (config.mailer_url == "" || config.mailer_key == "") {
 | 
				
			||||||
 | 
					    consola.error("Error: invalid mailer config")
 | 
				
			||||||
    errors++;
 | 
					    errors++;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
function getPhoneCodeLocale(): CountryCode {
 | 
					function getPhoneCodeLocale(): CountryCode {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user