envinos

1.0.5 • Public • Published

CI status npm downloads npm license version


Sync and share your local environment variables from AWS Secrets Manager service among developers

[!NOTE] Currently only support AWS Secrets Manager, but in the future, may support other external stores with dedicated plugins

Usage

To use the package you first need to install it as dev dependency:

npm i -D envinos

Then you need to configure your package.json#scripts with:

{
	"postinstall": "envinos"
}

This will automatically sync the environment variables from AWS Secrets Manager service once any developer in the team will run npm i.

Configuration

You can specify the configuration of Envinos through various options, but one must be provided. Configuration can be set in the following files (can be configured in home directory or in the root folder of your project):

  • a package.json property: "envinos": {...} or in ~/package.json, for example
  • a .envinosrc file in JSON or YAML format
  • a .envinosrc.json, .envinosrc.yaml, .envinosrc.yml, .envinosrc.js, or .envinosrc.cjs file
  • a envinos.config.ts, envinos.config.js, or envinos.config.cjs CommonJS module exporting an object

Configuration Options

  • secrets (required): an array of objects, where you configure multiple environment variables files.
  • secrets.*.label (optional) - Label of the environment variables
  • secrets.*.key (required) - The AWS Secrets Manager entry identifier, where the secrets will be fetched from
  • secrets.*.filePath (required) - The file path where the environment variables will be stored
  • skipKeyword (optional): sometimes, you have some environment variables that should be configured per each developer and not shared. You can set an explicit keyword, so Envinos won't override the variables with this keyword. For example, if you set it to "TODO" and set the value of variable "MY_ENV" in AWS Secrets Manager with value of "TODO" - Envinos won't override this variable "MY_ENV" (which might have been configured manually by the developer).
  • region (optional): A valid AWS region - where you store your secrets in the AWS Secrets Manager service. If you don't provide this field, Envinos will fail, unless you have AWS_REGION configured in the user environment variables.

For nested keys, you can read their purpose and description in the JSONSchema.

View JSONSchema of the configuration:
{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"$ref": "#/definitions/envinos",
	"definitions": {
		"envinos": {
			"description": "Envinos Configuration Schema",
			"type": "object",
			"properties": {
				"secrets": {
					"type": "array",
					"items": {
						"type": "object",
						"properties": { "label": { "type": "string" }, "filePath": { "type": "string" }, "key": { "type": "string" } },
						"required": ["filePath", "key"],
						"additionalProperties": false
					}
				},
				"skipKeyword": { "type": "string" },
				"region": { "type": "string" }
			},
			"required": ["secrets"],
			"additionalProperties": false
		}
	}
}

Authors

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i envinos

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

17.3 kB

Total Files

15

Last publish

Collaborators

  • tal-rofe