Global

Methods

checkEnvsAreExported(variables)

Checks if the variables retrieved from the .env file, exist in the current node running instance
Parameters:
Name Type Description
variables Map A Map of the variables that were retrieved from the .env file
Source:

(async) checkSourceCode(sourceCodeFolder, originalVariables)

Scans source code files, finds used environment variables, and if there are variables that dont exist in the .env file, throws an error
Parameters:
Name Type Description
sourceCodeFolder *
originalVariables *
Source:

compareDotenvs(sample, original) → {Boolean}

Checks if the sample and the original .env files contain the exact same variables
Parameters:
Name Type Description
sample Map The variables that were retrieved from the sample .env file
original Map The variables that were retrieved from the .env file
Source:
Returns:
Returns true if both files match each other
Type
Boolean

execute()

Executes all validations
Source:

(async) readDotenv(fileName) → {Promise}

Reads a .env file and returns its content in utf-8 format
Parameters:
Name Type Description
fileName String The name of the .env file to check
Source:
Returns:
Promise object represents the contents of the file
Type
Promise

transformDotenv(file) → {Array}

Splits the file into lines, in every linebreak, and then splits on = character
Parameters:
Name Type Description
file String The .env file as a utf-8 string
Source:
Returns:
An array containing each line formatted
Type
Array

validateDotenv(processedLines) → {Map}

Checks if all environment variables passed to the .env file have valid names, and if there are any duplicates
Parameters:
Name Type Description
processedLines Array An array, representing each line of the .env file as an array, that contains the environment variable name in index 0, and the value of the variable in index 1
Source:
Returns:
A map containing the environment variable names as its keys, and null as the value of these keys
Type
Map