Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastify-secrets-env

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-secrets-env

Fastify secrets plugin for environment variables

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
increased by17.37%
Maintainers
1
Weekly downloads
 
Created
Source

Fastify Secrets Env

CI

Fastify secrets plugin for environment variables

This plugin is mostly intended for your local dev environmemt where you may want to use the same api as production-ready plugins like fastify-secrets-gcp whilest still reading config from environment variables. We suggest to use a proper secret manager in production.

Installation

npm install --save fastify-secrets-env

Usage

This plugin will read secrets from environment variables and decorate fastify with a secrets object. It is agnostic on how the environment variables are set: it is not a replacement of dotenv, and can work in conjuction with it.

Add plugin to your fastify instance


const FastifySecrets = require('fastify-secrets-env')

fastify.register(FastifySecrets, {
  secrets: {
    dbPassword: 'PG_PASS'
  }
})

Access you secrets


await fastify.ready()

console.log(fastify.secrets.dbPassword) // content of process.env.PG_PASS

Plugin options

The plugin only expect the secrets object in the options.

It is a map of keys and environment variables names. fastify-secrets-env will decorate the fastify server with a secrets object where keys will be the same keys of the options and the value will be the content of the environment variables referenced by the value.

Contributing

See CONTRIBUTING.md

License

Copyright NearForm Ltd 2020. Licensed under the Apache-2.0 license.

Keywords

FAQs

Package last updated on 21 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc