CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-grunt-env

Grunt plugin for specifying environment variable configurations in task chains

81

0.98x
Overview
Eval results
Files

task.mdevals/scenario-6/

Envdir-Based Environment Loader

Configure a Grunt workflow that loads environment variables for a staging target from envdir-style directories, then exposes a verification task that consumes the loaded values.

Capabilities

Directory-driven environments

  • Running the staging task chain reads files under config/envdir/staging/*, sets process.env.API_URL and process.env.DB_USER from matching filenames, and a follow-up task can read them without extra configuration. @test
  • Files placed inside nested directories under config/envdir/staging/ (e.g., config/envdir/staging/secret/IGNORED) are skipped and never added to process.env. @test
  • When process.env.PORT is already set before running the staging setup, that value remains unchanged unless an inline override is provided alongside the directory ingestion; other variables from the directory still load. @test

Implementation

@generates

API

module.exports = function (grunt) {
  // configures a staging target that loads environment variables from config/envdir/staging/*
  // optionally defines inline overrides for select variables such as PORT
  // registers a task chain (e.g., "staging") that loads the variables and a follow-up task that reads them
};

Dependencies { .dependencies }

grunt-env { .dependency }

Loads environment variables for Grunt tasks, including directory-based ingestion of files into process.env.

Install with Tessl CLI

npx tessl i tessl/npm-grunt-env

tile.json