🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

fi-credentials

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fi-credentials

Simple JSON credentials loader for local and S3 sources.

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
3
-57.14%
Maintainers
1
Weekly downloads
 
Created
Source

Fi Credentials

Build Status npm npm

Simple JSON credentials loader for local and S3 sources.

Installing

npm install --save fi-credentials

Usage

const credentials = require('fi-credentials');

Loading credentials

This module exports an Object that exposes the following Functions:

const credentials = require('fi-credentials');

credentials.load(config).then((creds) => {
  console.log('Credentials loaded!', creds);

  creds // All the credentials object.
  credentials.get(); // All the credentials object.

  creds.database; // Database property values only.
  credentials.get('database'); // Database property values only.
})

.catch(err => {
  throw err;
});

IMPORTANT: Your credential's file must be a valid JSON file.

Configuration

It must be an Object with the following parameters:

ParamTypeRequiredDefaultDescription
sourceStringNoundefinedCan be used specify 's3' as source. Anything else will be local by default.
debugFunction|BooleanNoFunctionCan be a Function to log with or a Boolean. If true it will use console.log.
s3ObjectIf source is 's3'undefinedThis is the get object params config for the AWS SDK S3 client.
s3.bucketStringIf source is 's3'undefinedThe S3 bucket name from where to obtain the object.
s3.keyStringIf source is 's3'undefinedThe S3 bucket key name from where to obtain the credentials file.
s3.apiVersionStringIf source is 's3'undefinedThe S3 API version to use.
localObjectIf source is not 's3'undefinedThe local configuration object.
local.pathStringIf source is not 's3'undefinedThe local path to the credentials file.

Example

const config = {

  source: 's3', // Or anything else for local.

  debug: true, // Or you may use the debug module function.

  s3: {
    key: 'path/to/credentials.json',

    apiVersion: '2006-03-01',

    bucket: 'bucket-name'
  },

  local: {
    path: '/local/path/to/credentials.json'
  }

};

API

View the API docs here.

Keywords

grouping

FAQs

Package last updated on 10 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts