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 🙏

© 2026 – Pkg Stats / Ryan Hefner

compose-env-azure

v0.1.1

Published

Azure Key Vault source adapter for compose-env

Readme

compose-env-azure

Azure Key Vault source adapter for compose-env.

npm License: MIT


Installation

npm install compose-env-azure @azure/keyvault-secrets @azure/identity

compose-env must also be installed in your project.


Usage

import { defineConfig, source } from 'compose-env'
import { azureKeyVaultSource } from 'compose-env-azure'

const config = await defineConfig(
  {
    DATABASE_URL: { type: 'url',    required: true, secret: true },
    API_KEY:      { type: 'string', required: true, secret: true },
    PORT:         { type: 'port',   default: 3000 },
  },
  {
    sources: [
      azureKeyVaultSource('https://my-vault.vault.azure.net'),
      source.env(),
    ],
  },
)

By default, all enabled secrets in the vault are loaded. Azure secret names use hyphens (e.g. my-db-url), which are converted to underscores and uppercased (MY_DB_URL) to match env var conventions.


Load Specific Secrets Only

To avoid loading every secret in the vault, pass an explicit list:

azureKeyVaultSource('https://my-vault.vault.azure.net', {
  secrets: ['database-url', 'api-key'],
})

Key Normalization

Azure Key Vault secret names are normalized automatically:

| Vault secret name | Resolved key | |-------------------|-----------------| | database-url | DATABASE_URL | | api-key | API_KEY | | redis-ttl | REDIS_TTL |


Options

| Option | Type | Default | Description | |-----------|------------|---------|--------------------------------------------------------------------------------------| | secrets | string[] | — | List of secret names to load. If omitted, all enabled secrets in the vault are loaded. |


Authentication

Authentication is handled by DefaultAzureCredential, which tries the following in order:

  1. Environment variablesAZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
  2. Workload Identity — For AKS pods with federated credentials
  3. Managed Identity — For Azure VMs, App Service, Container Apps, etc.
  4. Azure CLIaz login for local development

No additional configuration is needed when running in an Azure-managed environment.


Required Access Policies

The identity must have the Get and List secret permissions on the Key Vault:

# Azure CLI
az keyvault set-policy \
  --name my-vault \
  --object-id <principal-object-id> \
  --secret-permissions get list

Or assign the Key Vault Secrets User built-in role if using RBAC authorization.


Source Priority

Sources are resolved in order. Place azureKeyVaultSource before or after source.env() depending on which should take precedence:

// Key Vault overrides local .env files
sources: [source.env(), azureKeyVaultSource('https://my-vault.vault.azure.net')]

// Local .env files override Key Vault (useful for local development)
sources: [azureKeyVaultSource('https://my-vault.vault.azure.net'), source.env()]