New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@leadhome/envsubfolder

Package Overview
Dependencies
Maintainers
7
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leadhome/envsubfolder

Inject environment variables into all html files in a folder

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
7
Weekly downloads
 
Created
Source

envsubfolder

A cli utility that walks a folder recursively, replacing any environment variables in all the HTML files it finds.

Usage

Install this package globally using:

npm install -g envsubfolder

You should then be able to use it like this:

envsubfolder <target>

What it's doing

This utility starts by making a backup of the <target> folder at <target>_bak. For example, if you run envsubfolder app, this utility will make a backup of the app folder to app_bak. If this backup folder already exists, it will instead restore the backup folder app_bak to app.

This utility will then look for any files ending in .html recusively, replacing any instance of ${<env_var>} with the value of the environment variable called <env_var>. For example, this utility will replace any instance of ${VERSION} with the value of the environment variable VERSION.

Purpose

Based on https://12factor.net/, it is considered best practice to build your application artifact independent of it's runtime configuration. This means building an artifact that does not have any configuration "backed in", but rather that accepts configuration at runtime, specifically in the form of environment variables. This affords one the flexibility to use the exact same artifact to run the application in any environment with any conbination of configuration.

This utility is aimed to help achieve this behaviour for UI projects.

Keywords

FAQs

Package last updated on 18 Feb 2020

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

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