@mck-p/project-envs

0.0.1 • Public • Published

Project Envs

CircleCI

Usage

const { writeEnvs, formatEnvs, createEnvs } = require("@mck-p/project-envs");

/* Given some object */
const data = {
  /*
      That can have meta keys
      or other data that you need
      to write your envs. These
      do not get written to env,
      they are only here for meta/
      resolving data
  */
  other: {
    turtle: "face"
  },
  // This will create SERVICE_NAME: "RESOURCES_SERVICE"
  SERVICE_NAME: "RESOURCES_SERVICE",
  // This will create SERVICE_FULL_NAME: "face:RESOURCES_SERVICE::FULL"
  SERVICE_FULL_NAME: "${other::turtle}:${SERVICE_NAME}::FULL"
};

const formattedEnvs = formatEnvs(createEnvs(data));
/* 
    ["SERVICE_NAME=RESOURCES_SERVICE", "SERVICE_FULL_NAME=face:RESOURCE_SERVICE::FULL"]
*/

writeEnvs(formattedEnvs, __dirname + "/.env").then(() => {
  /*
    .env written as

      SERVICE_NAME=RESOURCES_SERVICE
      SERVICE_FULL_NAME=face:RESROUCE_SERVICE::FULL

  */
});

Readme

Keywords

none

Package Sidebar

Install

npm i @mck-p/project-envs

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

4.93 kB

Total Files

7

Last publish

Collaborators

  • beardedtim