0.1.0 • Published 1 year ago

@blastz/json-to-env v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
1 year ago

json-to-env

Install

$ npm install @blastz/json-to-env

Hello json-to-env

Create env.json at the root of project

// env.json
{
  "custom": {
    "app": {
      "stringValue": "app",
      "trueValue": true,
      "falseValue": false,
      "arrayValue": [true, "true", 1],
      "numberValue": 1,
      "objectValue": {
        "name": "app2"
      }
    }
  }
}

Import json-to-env

import "@blastz/json-to-env";

Parsed environment values

process.env.CUSTOM_APP_STRING_VALUE === "app";
process.env.CUSTOM_APP_TRUE_VALUE === "true";
process.env.CUSTOM_APP_FALSE_VALUE === "";
process.env.CUSTOM_APP_ARRAY_VALUE === '[true,"true",1]';
process.env.CUSTOM_APP_NUMBER_VALUE === "1";
process.env.CUSTOM_APP_OBJECT_VALUE_NAME === "app2";

License

MIT

0.1.0

1 year ago