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

1p-env

v1.0.0

Published

Quickly and easily generate your .env file from credentials stored in 1Password.

Downloads

6

Readme

1Password .env Generator

Quickly and easily generate your .env file from credentials stored in 1Password.

About

This script is designed to be used with the 1Password CLI. The generator will ask you a few questions about the item you want to use, and then generate formatted .env key/value pairs for you.

Requirements

To use this package, the 1Password CLI must be installed on your device and logged in.

Running the script

To run the script simply enter npx 1p-env in your terminal.

Example CLI output:

? What is the item's name? env_variables
? What vault is this item in? Dev
? What section is this item in? demo-app
? How would you like the output? 1Password reference values

✔ Entries found! Copy the following value(s) into your env file:

DB_URL="op://Dev/env_variables/demo-app/DB_URL"
DB_USER="op://Dev/env_variables/demo-app/DB_USER"

Documentation

In order for the script to run correctly, it expects that an item is created in 1Password with the following:

  1. Sections are used to group each of your app's credentials.
  2. Password fields are used to store credentials, with the label of each field named after the environment variable you want to create.

Example Setup

Example Setup

CLI Guide

When running the CLI, you will be asked the following questions:

  1. "What is the item's name?" - This is the name of the item in 1Password that contains your credentials.
  2. "What vault is the item in?" - This is the vault that the item is stored in.
  3. "What section is this item in?" - This is the name of the section in the item that contains the credentials.
  4. "How would you like the output?" - This is the format of the output. Currently, there are two options:
    1. Actual values: This will output the actual values of the credentials. (e.g., DB_USER=admin)
    2. 1Password reference values: This will output the 1Password reference values of the credentials. (e.g., DB_USER="op://<vault>/<item_name>/<section>/DB_USER"). To run your app when using this format in your .env, prefix your app's run command with op run --no-masking --env-file=".env" -- . For example, for a Next.js Application you would run op run --no-masking --env-file=".env" -- npm run dev. Make sure to replace .env with the name of your .env file. See more on the official 1Password developer docs here.

Notes

This is an open-source tool and is not affiliated with 1Password.