Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adobe/aio-lib-core-config

Package Overview
Dependencies
Maintainers
18
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adobe/aio-lib-core-config - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "@adobe/aio-lib-core-config",
"version": "2.0.0",
"version": "2.0.1",
"description": "Adobe I/O Configuration Module",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -18,3 +18,3 @@ <!--

[![Downloads/week](https://img.shields.io/npm/dw/@adobe/aio-lib-core-config.svg)](https://npmjs.org/package/@adobe/aio-lib-core-config)
[![Build Status](https://travis-ci.com/adobe/aio-lib-core-config.svg?branch=master)](https://travis-ci.com/adobe/aio-lib-core-config)
![Node.js CI](https://github.com/adobe/aio-lib-core-config/workflows/Node.js%20CI/badge.svg)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

@@ -54,3 +54,3 @@ [![Codecov Coverage](https://img.shields.io/codecov/c/github/adobe/aio-lib-core-config/master.svg?style=flat-square)](https://codecov.io/gh/adobe/aio-lib-core-config/)

## Peristent File Locations
## Persistent File Locations

@@ -57,0 +57,0 @@ ### User Configuration

@@ -26,2 +26,3 @@ /*

const parse = (file) => {
checkForDuplicates(file)
const buf = Buffer.from(fs.readFileSync(file, 'utf-8'))

@@ -32,2 +33,39 @@ return dotenv.parse(buf) // will return an object

/**
* parse file for environmental variables and log debug message for duplicate definitions
*
* @param {String} file filepath to parse
*/
const checkForDuplicates = (file) => {
try {
const NEWLINES_MATCH = /\n|\r|\r\n/
const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/
const buf = Buffer.from(fs.readFileSync(file, 'utf-8'))
const obj = {}
const dupKeys = []
buf.toString().split(NEWLINES_MATCH).forEach(function(line, idx) {
const keyValueArr = line.match(RE_INI_KEY_VAL)
if (keyValueArr != null) {
const key = keyValueArr[1]
if (obj[key]) {
dupKeys.push(`${key}`)
} else {
obj[key] = 'dummy'
}
}
})
if (dupKeys.length > 0) {
let debugMsg = 'duplicate declaration of environment variable(s)'
dupKeys.forEach((key) => {
debugMsg = debugMsg + ` ${key},`
})
debugMsg = debugMsg.slice(0, -1)
debugMsg = debugMsg + ` in ${file}`
debug(debugMsg)
}
} catch (err) {
// Ignore
}
}
/**
* returns all keys in o1 that arent in o2

@@ -34,0 +72,0 @@ *

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc