npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

postman-env-templater

v0.0.6

Published

Creates postman environment files from env template files

Downloads

25

Readme

Postman-env-templater

Creating postman collections using environments so you can easily switch between dev, test, beta, prod, etc is a great thing. Makes it easy to to test and work with your code across all the environments you support. However, most api calls require some sort of secret information like an api key or auth credentials. And we cannot check that information into the repo. And maybe Postman Cloud is not a solution that you can use. Now when you use the environment for the first time or you want to pull in any updates to it, you will need to look up that secret information and update your local environments, but also, ensure your local copies with the secrets do not accidentally get check back into the repo.

This is where postman-env-templates helps. You save your secrets to SSM and update your env templates to have the ssm path. You can save your templates to the repo. The logic takes the template, looks up any SSM params needed, and then creates the real postman env files with the secret values. Lastly, you use gitignore to ensure those real environment files do not get checked into the repo.

Help

postman-env-templater

Utility script for setting up postman environment files.  (i.e. update secrets from ssm)

Usage:
    postman-env-templater OPTION[S]

OPTIONS:
        --help               displays help
    -t  --template-file      environment template file to process
    -o  --output-dir         OPTIONAL: where to save processed environment file; defaults to current directory
    -w  --working-dir        OPTIONAL: where to set the working directory; defaults to current directory
    -r  --region             OPTIONAL: aws region to use

Examples:
    yarn postman-env-templater --template-file=./postman/env-templates/dev.json                  processes the dev environment file

Install

  • If using yarn, run yarn add postman-env-templater
  • If using npm, run npm install postman-env-templater

Usage

  • Create a folder for your env templates. Create a json file for each environment that will be templated.
postman
  projectA.postman_collection.json
  - env-templates
    dev.json
    test.json
    beta.json
    prod.json
  • Update .gitignore and add your environments folder which will be sibling to the env-templates folder
#.gitignore
postman/environments/
  • Update the environment templates. In the values array, add any non secret variables and their correct values and set enabled to true. For secrets, append to the key "4TEMPLATER:" and its value should be ssm path appended with "ssm:" and set enabled to false. Like so:
# postman/env-templates/dev.json
{
  "name": "project-a-dev",
  "values": [
    {
      "key": "baseUrl",
      "value": "https://dev-api.projecta.com/api",
      "type": "default",
      "enabled": true
    },
    {
      "key": "4TEMPLATER:username",
      "value": "ssm:/projectA/dev/username:false",
      "type": "secret",
      "enabled": false
    },
    {
      "key": "4TEMPLATER:password",
      "value": "ssm:/projectA/dev/password:true",
      "type": "secret",
      "enabled": false
    }
  ]
}
  • Add postman-env-templater to your project as dev dependency
  • Run the following command per environment you want to template. You will need to have the correct credentials in your default profile
# assuming using yarn
yarn postman-env-templater --working-dir=$PWD --template-file=./env-templates/dev.json -output-dir=./environments --region=us-west-2
  • Now you can import the environment folder into postman with all the secrets populated