https://github.com/hemicharly/lib_ms_setting_client
https://github.com/hemicharly/lib_ms_setting_client
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hemicharly/lib_ms_setting_client
- Owner: hemicharly
- Created: 2021-10-24T18:22:57.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-07T17:46:58.000Z (almost 4 years ago)
- Last Synced: 2025-02-23T14:43:21.876Z (8 months ago)
- Language: JavaScript
- Size: 55.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## MS-SETTINGS_CLIENT
#### 1. Requirements Installation
* Install NodeJs Version 16.13.0
* Yarn 1.22.4
* Git#### 2. Generator library
```bash
yarn lib
```#### 3. Example use the library
##### 3.1. Using the library to load application settings
```bash
import { loadSettings } from 'ms_settings_client';
``````bash
const applicationName = 'API_NAME';
const applicationUuid = process.env.APP_IDENTIFIER;
await loadSettings({
urlSubscribe: `${process.env.BEPAY_MS_SETTING_URL}/v1/application/subscribe?applicationUuid=${applicationUuid}&applicationName=${applicationName}`,
urlGetSettings: `${process.env.BEPAY_MS_SETTING_URL}/v1/environment/${applicationUuid}`,
applicationUuid,
applicationName,
secretKeyGlobal: process.env.MS_SETTING_SECRET_KEY_GLOBAL,
});
```##### 3.2. Using the library to encrypt and decrypt
```bash
import { cryptoDecrypt } from 'ms_settings_client';
``````bash
const secretKey = applicationUuid || process.env.MS_SETTING_SECRET_KEY_GLOBAL;
const message = await cryptoDecrypt.encrypt(value, secretKey);
const message = await cryptoDecrypt.decrypt(value, secretKey);
```