Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
/ env-args Public archive

Source program arguments from the environment in a predictable way

License

Notifications You must be signed in to change notification settings

chrisdone-archive/env-args

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

env-args

Useful when deploying programs where passing environment variables is more convenient and more secure than passing arguments to the process.

Add to your stack.yaml:

- github: chrisdone/env-args
  commit: bfcad7b70c217218fd512bf8dbd90bead51e9385

And in your app/main.hs:

import System.EnvArgs

Wrap withEnvArgs "YOURPREFIX_" around your arguments parser (e.g. optparse-applicative), and now you can pass

  • YOURPREFIX_arg1=blah for --arg1 blah (drops the prefix and adds --).
  • YOURPREFIX_arg_foo for --arg-foo (replaces _ with -)
  • YOURPREFIX_ARG_FOO for --arg-foo (auto-lower-casing)

About

Source program arguments from the environment in a predictable way

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published