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

1password-dot-env-sync

v1.0.5

Published

Sync secrets between .env and 1Password vault

Downloads

32

Readme

1password .dot env sync

npm version

Overview

1password-dot-env-sync is a command-line tool that synchronizes secrets between .env files and 1Password vaults. This tool allows you to keep your environment variables secure by leveraging 1Password's vault management and syncing capabilities.

Features

  • Sync Secrets: Easily sync your .env files with 1Password vaults, ensuring all secrets are stored securely.
  • 1Password SDK Integration: Utilizes the official 1Password SDK to interact with vaults.
  • CLI Commands: Intuitive command-line interface for syncing and managing your secrets.
  • Modular Management: Handles the configuration, environment, and 1Password interactions in a modular way.

Roadmap

  1. Support for Multiple .env Files:

    • Future releases will support syncing across multiple environment files (e.g., local, prod, dev).
  2. Support sub directory .env files:

    • Future releases will support the ability to sync .env files that are in subdirectories within the project root.
  3. Vault Creation:

    • When the 1Password SDK supports it, we will add the ability to create new vaults directly from the CLI.
  4. Extended CLI Commands with Flags:

    • We plan to extend the CLI with more commands and flags to enhance the flexibility and usability of the tool.

Getting Started - Local Development

Prerequisites

  • Node.js (version >= 18.0.0)
  • NPM or Yarn

Installation

Clone the repository and navigate to the project directory:

git clone https://github.com/yourusername/1password-env-sync.git
cd 1password-env-sync

Install the dependencies:

npm install

Local Development Setup

To start developing or modifying the tool locally, follow these steps:

  1. Build the Project: Compile the TypeScript files.

    npm run build
  2. Watch for Changes: Automatically rebuild the project when files change.

    npm run watch
  3. Start the Application: Run the CLI tool.

    npm start

Usage

To start using the tool and to sync your .env file with a 1Password vault, simply run the following command:

npx 1password-env-sync init

This will initiate the setup of the tool and prompt you to configure the 1Password service account connection (if you don't know how to create 1password token you can find the instructions on the following Link).

After the setup is complete, you can sync your .env file with the 1Password vault by running:

npx 1password-env-sync sync

This will read the default .env file in the root directory and sync the variables with the specified 1Password vault configured in your setup.

CLI Commands

  • sync: Syncs the default .env file with the 1Password vault.
  • diff: Compares secrets between the .env file and the 1Password vault.
  • help: Displays help for a command.

Configuration

The tool uses a configuration file to manage settings. By default, it looks for a config.yaml file in the root directory.

Project Structure

  • src/: Contains the TypeScript source files.
  • dist/: Compiled JavaScript files.
  • envManager.ts: Handles loading and parsing .env files.
  • onePasswordManager.ts: Interfaces with the 1Password SDK.
  • syncManager.ts: Coordinates the syncing process between .env files and 1Password vaults.
  • cli.ts: Defines the command-line interface and commands.
  • configManager.ts: Manages application configurations.
  • logger.ts: Provides logging functionality across the application.
  • utils.ts: Utility functions used throughout the application.

How to contribute

This project is actively looking for maintainers, so feel free to reach out to me if you want to contribute to it.

E-mail: [email protected]

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Tomislav Balabanov