1.0.2 • Published 11 months ago

@taro-common/common-config v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

🤖 Common Config Library

library สำหรับรับค่า vault ใน environment ต่าง ๆ สามารถขอให้ Setup vault ได้ที่ channel #usick-help

😶‍🌫️ Installation Guide

Environment ที่สำคัญ

  • node ^16.x.x
  • npm ^8.x.x

Install Library

  1: 📄 npm i @taro-common/common-config

Usege

const Config = require('@taro-common/common-config');

// start: async await
async function main() {
    const config = new Config();
    const value = await config.get("api-secret-name", "default-value");
    // if found will return value in vault else "defulte-value"
    console.log(value);
}
main();
// end: async await

// start: promise
const config = new Config();

config.get('api-secret-name', "defulte-value").then((value) => {
    // if found will return value in vault else "defulte-value"
    console.log(value);
})
// end: promise

Devolopment

  • สำหรับการ development ให้ set environment=local ใน .env
environment=dev
  • สำหรับ production ให้ set environment={env} และ service={service name} ใน environment ตามที่ขอ
environment=dev
service=test-common-vault
1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago