Skip to content

Environments #12

@manishtomar

Description

@manishtomar

Add environments feature similar to paw's. At minimum an environment should define URL and headers. It may make sense to have templates in environments but that can be done later. For example, one can have production and local environment. Following is example config if you are developing github API:

config = {
    "name": "github",
    "description": "Github API",
    "environments": {
         "production": {
              "uriprefix": "https://api.github.com",
              "default": true,
              "headers": {"Authorization": {"env": "GITHUB_PROD_AUTH"}}
        },
         "local": {
              "uriprefix": "http://localhost:4000",
              "headers": {"Authorization": {"env": "GITHUB_LOCAL_AUTH"}}
        },
    },     
    "headers": {
        "accept": "application/json",
        "content-type": "application/json"
    },
}

Here, there are global headers which will be merged with environment specific headers with env ones taking precedence.

There can be --env option that has default environment when not provided which in above is config is production. Have --set-default-env option that will change the default env.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions