Pudu programming language
Menu
Package

@chrismichaelps / pudu-lang-environment

Environment files for Pudu: load .env variables safely with layered files, discovery, expansion, typed reads, and secrets kept out of every message

0.1.0Apache-2.01

InstallClose

Releases

A release never changes; a yanked one still installs from an existing lock.

Latest

0.1.0

The first release of @chrismichaelps/pudu-lang-environment: environment files for Pudu that keep a program's secrets out of version control and out of every message the package produces.

pudu install @chrismichaelps/pudu-lang-environment

Needs Pudu 0.1.3 or later. API documentation: the wiki.

Highlights

  • The .env format: comments, quoted values across lines, escaped quotes, inline comments, export syntax, trimming, and expansion with ${NAME:-default} and ${NAME-default}.
  • Finding files: given files, upward probing, and the environment cascade (.env, .env.local, .env.<name>, .env.<name>.local) selected by PUDU_ENV or PROFILE, refusing names that could leave their directory.
  • Loading: strict or lenient, overwrite rules, options validated as a whole, UTF-8, ASCII, Latin-1, UTF-16, and UTF-32 with byte-order marks, and text or byte sources.
  • Variables: the loaded values settled over the process environment without writing it, with typed reads, secrets, required keys, and hand-off to child processes.
  • Typed settings: records that derives Binding.Bind read themselves from variables with @env, @default, and @secret; derives Binding.Redacted renders them with every secret hidden; Settings.bind checks them with @chrismichaelps/pudu-lang-validator.
  • Application configuration: config.withVariables(&variables) layers loaded variables over Std.App.Config settings.
  • Secrecy: no problem, description, or rendering carries a value read from a file.

Quality

20 suites with 376 assertions, six runnable examples, and mutation testing of the pure layer killing 131 of 131 mutants, on Linux CI against the published Pudu 0.1.3 archive.

pudu install @chrismichaelps/pudu-lang-environment@0.1.0
Browse the source →