Skip to content
/ curlenv Public template

Template for managing prepared curl requests.

License

Notifications You must be signed in to change notification settings

brettbuddin/curlenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

curlenv

curlenv set of conventions for managing prepared HTTP requests via curl. Environments are just collections of shell environment variables that are managed by direnv.

It aims to be a simple command-line alternative to Postman that directly leverages well known tools.

It's recommended you use curl v8.7.0 or greater. curl v8.7.0 fixed a bug (curl/curl@0f0edc2) where curl would not fail when it encountered a missing environment variable.

⚠️ This project uses direnv's source_env and source_env_if_exists functions to apply environment files. These functions are documented as not using direnv's security framework. This is a potential attack vector, and means you must trust repository committers and audit changes to environments in contributions.

Template

This a template repository and meant to be cloned as a starting point for your own project. In GitHub you can click the Use this template button at the top of this page to get started.

Files within env, data, request, and workflow directories are only examples and can be deleted to be replaced by our own. They exist as a starting point for your own work.


Directories and Files

Name Description
env/ *.envrc files for direnv.
data/ Static and templated data files.
request/ Requests defined by curl configuration files.
workflow/ Compositions using data and request files.
.envrc Entrypoint file for direnv.
required-variables.txt List of environment variables that are considered required for the project. All environments must set these variables.
.localrc Uncommitted, local run commands sourced by .envrc
.curlenv.envrc Generated by bin/curlenv-switch using *.envrc files in env/. This file is sourced by .envrc by direnv.

Environments

Environments are managed by direnv and loaded with the bin/curlenv-switch command.

Refer to the direnv documentation for *.envrc syntax and stdlib functions.

You can load environments via the bin/curlenv-switch script. The command accepts a single argument for the environment name. References to both the primary environment file (<name>.envrc) and optional secrets file (<name>.secret.envrc) are placed into a file at the root of the project called .curlenv.envrc.

; curlenv-switch staging
direnv: loading ~/example/.envrc
direnv: loading ~/example/.curlenv.envrc
direnv: loading ~/example/env/example.envrc
direnv: export +EXAMPLE_HEADER +EXAMPLE_HOSTPORT +EXAMPLE_SCHEME +CURLENV_CURRENT -PS2 ~PATH

Environment variables added to required-variables.txt are added to the generated .curlenv.envrc file so direnv alerts you of missing environment variables across different environments.

About

Template for managing prepared curl requests.

Topics

Resources

License

Stars

Watchers

Forks