0.1.7 • Published 4 years ago

@finfront/system-unstable v0.1.7

Weekly downloads
-
License
UNLICENSED
Repository
gitlab
Last release
4 years ago

Finfront SDK: system package

The SDK is available from NPM with the namespace @finfront/system. The package is private so you must have a registered account to install it. The SDK is structured as separate packages available at @finfront/$package.

$ NPM install @finfront/system --save

To run this package you will also need to install the sdkCore package: $ NPM install @finfront/core --save Configuration: In order for the sdk to configure properly you must do the following:

1. In the vars.js file in your service you need to add the require for the sdkCore as the first line followed by 
the require for globalVars. This is needed so that globalVars is configured before vars. 
     const sdkCore = require('@finfront/core');
     const globalVars = sdkCore.globalVars;
2. If you are starting the service as a container or pod. Start your service with the following environment variables:
   * FFCLUSTER: the deployment environment, e.g. docker, dev, stage, prod. 
   * FFSVC_NAME: the name of the service you are starting, e.g pl_v0 
   Example: in docker you would set these in the $ docker run command:
   $ docker run --env FFCLUSTER=docker --env FFSVC_NAME=login --name login -p 14046:14046  login_v0:stable

Documentation: Learn how to use the sdk by reading the jsDocs.

  • jsdocs in system/docs/jsdocs/index.js

@finfront/system

 ```const sdkSystem = require('@finfront/system');```	

sequelize objects

  1. db1System.js: Functions to interact with the db1System database. let db1Sys = sdkSystem.db1System;
  • getCachedDb1SysObj(svcUuid);
    • Usage: This function creates a connection to the dbiSystem database using sequelize. The db object will be cached for the life of the process. Under normal operation there should be no need to reset this object. This function will use db credential that are also cached. if there is any problem with the cached credentials the function will pull new credentials from vault. It also uses cached creds for vault. in case the vault creds have expired, this funciton will also pull new creds from s3. In unexpected cases you can reset the cached db object by using the cleanUp function and then using getCachedDb1SysObj() again. the db object will be recreated and cached again.
  • cleanUpDb(svcUuid, dbInstance); Usage: Function to close down the connection in the dbObj and also reset the local cache.
  • setCachedDb(); DO NOT USE THIS FUNCTION. it is only exposed for testing purposes.

vault

  1. vaultWD.js: Functions that allow writing and deleting secrets to the vault server. In order to use these function each service needs their own vault credentials. The sdkCore has credentials included only for read operations. Write operations require the corresponding vault tokens.
    let vaultWD = sdkCore.vaultWD;
  • writeVaultData(tenantId, vaultToken, vaultServerUrl, vaultPath, key, valueObj);
    • Usage: Function that writes data to vault.
  • deleteVaultData(tenantId, vaultToken, vaultServerUrl, vaultPath, key);

    • Usage: Function that deletes data from vault.
           
0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.0

4 years ago