Giter Site home page Giter Site logo

portablestudios / serverless-dotenv Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 359 KB

๐Ÿญ Auto-generate your dotenv configuration from serverless framework exports

Home Page: https://portablestudios.github.io/serverless-dotenv/

License: MIT License

Nix 0.11% TypeScript 4.32% JavaScript 0.04% CSS 50.61% HTML 44.93%

serverless-dotenv's Introduction

๐Ÿญ serverless-dotenv

Auto-generate your dotenv configuration from serverless framework exports.


This CLI tool was created to assist when it came to deploying applications using the serverless framework and attempting to integrate it with a non-serverless based client-side application.

It means that you can:

  • use the serverless framework to implement a multistack approach for your application
  • get access to anything that you give a named export to in CloudFormation
  • output that to a dotenv file that can be used when you build your client-side application

Installation

Use yarn to either:

  • add it to your projects
  • install globally
  • run via npx
# Install into local package.json
yarn add https://github.com/portablestudios/serverless-dotenv --dev

# Install globally
yarn global add https://github.com/portablestudios/serverless-dotenv

# Run via npx without installation
npx https://github.com/portablestudios/serverless-dotenv

Usage

Create an envMap.yml file in your project that maps environment variables to the export names in your serverless stack. You can interpolate the stage value in these export names.

Example:

USER_UPLOADS_S3_BUCKET: myapp-${stage}-user-uploads-bucket
COGNITO_USER_POOL: myapp-${stage}-cognito-user-pool

Run serverless-dotenv with the required options.

npx https://github.com/portablestudios/serverless-dotenv --stage {stage} --profile {profile} --region {region}

It will create a dotenv file suffixed with the stage which you can then use in your application build.

USER_UPLOADS_S3_BUCKET: some-s3-bucket-name
COGNITO_USER_POOL: some-cognito-user-pool-arn

Options

  --stage       The stage you have provided for your serverless deploy. [string] [required]
  --profile     Your AWS profile as stored in your AWS credentials. [string] [required]
  --region      The AWS region that you are deploying to. [string] [required]
  --envMapFile  This file should contain the mapping for ENV variables to CloudFormation exports that you wish to use. [string] [default: "envMap.yml"]
  --version     Show version number [boolean]
  --help        Show help [boolean]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.