@huz-com/config
v1.0.9
Published
Base config
Downloads
20
Maintainers
Readme
Huz.Com > Component > Config
- Holds base config
Standards
- Language:
TS
- Eslint:
Yes
- Static Code Analysis:
Yes
IntelliJ Code Inspections - DDD - Document Driven:
Yes
- EDD - Exception Driven:
Yes
- TDD - Test Driven:
Yes
go to test folder - Standards Complied: Huz Standards
Commands
npm run clear
// clears "dist" foldernpm run lint
// runs eslint for static code analysisnpm run test
// runs test files in "test" foldernpm run build
// builds JS files at "dist" foldernpm publish
ornpm run publix
// publishes "dist" folder to npm
Install
npm i @huz-com/config
Samples
const {config} = require('@huz-com/config');
console.log(config.startTime); //integer, start timestamp
console.log(config.uptime); //integer, system uptime in seconds, os.uptime()
console.log(config.timeDiff); //{days:integer, hours: integer, minutes: integer, seconds: integer}
console.log(config.environment); //string, [prod, stage, test, dev] look: environmentEnum
console.log(config.project); //uuid, isolated project id
console.log(config.code); //string, isolated project code
console.log(config.isLocal); //boolean, is running at local
console.log(config.isolated); //boolean, is isolated project
console.log(config.debug); //boolean, is debug mode
console.log(config.language); //string, default language, [en, de, fr, ...] look: languageEnum
console.log(config.country); //string, default country, [UK, NL, DE, ...] look: countryEnum
console.log(config.timezone); //string, default timezone
console.log(config.application); //string, default application, [web, android, ios] look: applicationEnum
console.log(config.package); //string, name in package.json for current server
console.log(config.version); //string, version in package.json for current server
console.log(config.port); //integer, http port for current server
console.log(config.host); //string, host name of current server
console.log(config.ipMap); //{[string]: Array<string>}, ip map of current server
console.log(config.all()); //Record<string, unknown>, all of above settings
Important
In server index, you must import and initialize dotenv
package at first
// EcmaScript 6
import * as dotenv from "dotenv";
dotenv.config();
// EcmaScript 5
const dotenv = require("dotenv");
dotenv.config();