Code Monkey home page Code Monkey logo

curlenv's Introduction

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.

⚠️ curl v8.6.0 has a bug that prevents curl from failing when it encounters a missing environment variable. I reported the bug and it was fixed in curl/curl@0f0edc2. A new release hasn't been cut at the time of this writing, but it's recommended you use that new release when it arrives.

⚠️ 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.

curlenv's People

Contributors

brettbuddin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.