Modules@robinpath/dotenv

@robinpath/dotenv

0.1.0Public

Secure .env file management with key validation, path restrictions, and protected system variables

@robinpath/dotenv

Secure .env file management with key validation, path restrictions, and protected system variables

Category Functions Auth License

Why use this module?

The dotenv module lets you:

  • Parse a .env format string into an object
  • Convert an object to .env format string
  • Read a .env file and load values into process.env (won't override existing or protected vars by default)
  • Read a .env file and return as object without modifying process.env
  • Get a value from a .env file by key

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/dotenv

Quick Start

No credentials needed — start using it right away:

dotenv.stringify $vars

Available Functions

FunctionDescription
dotenv.parseParse a .env format string into an object
dotenv.stringifyConvert an object to .env format string
dotenv.loadRead a .env file and load values into process.env (won't override existing or protected vars by default)
dotenv.readRead a .env file and return as object without modifying process.env
dotenv.getGet a value from a .env file by key
dotenv.setSet a key=value in a .env file
dotenv.removeRemove a key from a .env file
dotenv.existsCheck if a .env file exists
dotenv.keysReturn all keys from a .env file
dotenv.expandExpand variable references like ${VAR} in values (process.env fallback disabled by default)

Examples

Convert an object to .env format string

dotenv.stringify $vars

Read a .env file and load values into process.env (won't override existing or protected vars by default)

dotenv.load ".env"

Read a .env file and return as object without modifying process.env

dotenv.read ".env.local"

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/dotenv";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  dotenv.stringify $vars
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/dotenv
Version0.1.0
LicenseMIT
Unpacked Size4.9 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

utilities