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

grvsls-offline-dotenv

v0.2.0

Published

Override environment variables when working locally with Serverless Offline.

Downloads

7

Readme

serverless-offline-dotenv

Deprecation Notice

Serverless v3 introduces built-in support for dot-env files making this plugin somewhat redundant since:

  1. it's always best to use built-in functionality wherever possible
  2. the behavior of the two implementations are very much alike (though I've not thoroughly tested for any variations in behavior so could be wrong)

Please update your projects to use the native support for dot-env files instead, or raise an issue if you believe this plugin should continue to be maintained (with reasons why).

Override environment variables configured in serverless.yml with any values provided in a .env file located at the root of your project.

Both global and function-specific environment variables are overridden.

This plugin is intended for local development only, and is therefore only invoked on serverless offline start.

Installation

Install the plugin:

yarn add -D serverless-offline-dotenv

Add the plugin to your serverless.yml file:

plugins:
    - serverless-offline-dotenv
    - serverless-offline

It is important that the serverless-offline-dotenv plugin is loaded before serverless-offline.

Creating a .env file

Create a file at the root of your project named .env containing the environment variables that you want to override locally.

# /path/to/project/.env

DB_HOSTNAME=127.0.0.1
DB_USER=me
# Lines starting with a hash are treated as comments
DB_PASSWORD=secret

Your .env file may contain sensitive information so you should add it to your .gitignore file.

You might want to provide a .env.example template to make setup easier for other developers.

# /path/to/project/.env.example

DB_HOSTNAME=127.0.0.1
DB_USER=<your local database username here>
DB_PASSWORD=<your local database password here>

Developers can then create a .env file from the template by running cp .env{.example,} and make the appropriate changes.

Serverless Variables

Any variables in your .env file that are prefixed with SLS_ are assumed to be variables supported by the Serverless framework and are therefore always appended to all functions.