# netlify-plugin-gcp-secret-manager-to-dotenv

> Get secrets from Google Cloud Secret Manager at build-time and persist them in a `.env` file during build.

Latest version **0.1.2** (published 2020-10-26) · 0 weekly downloads

## Install

```sh
npm install netlify-plugin-gcp-secret-manager-to-dotenv
pnpm add netlify-plugin-gcp-secret-manager-to-dotenv
yarn add netlify-plugin-gcp-secret-manager-to-dotenv
bun add netlify-plugin-gcp-secret-manager-to-dotenv
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2020-10-26 |
| First published | 2020-10-26 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | emilniklas |

## Links

- npm: https://www.npmjs.com/package/netlify-plugin-gcp-secret-manager-to-dotenv
- npm.io page: https://npm.io/package/netlify-plugin-gcp-secret-manager-to-dotenv

## Dependencies (1)

- [@google-cloud/secret-manager](https://npm.io/package/@google-cloud/secret-manager.md) ^3.2.0

## Recent versions

- 0.1.2 (latest) — 2020-10-26
- 0.1.1 — 2020-10-26
- 0.1.0 — 2020-10-26

## README

# netlify-plugin-gcp-secret-manager-to-dotenv

Get secrets from Google Cloud Secret Manager at build-time and persist them in a `.env` file during build.

## Usage
```shell
npm install --save-dev netlify-plugin-gcp-secret-manager-to-dotenv
```

Set an environment variable called `GCP_SERVICE_ACCOUNT` to the JSON payload of a GCP service account with read access to secrets stored in Secret Manager.

Use the inputs to this plugin to create mappings between secret names and environment variables.

```toml
[[plugins]]
package = "netlify-plugin-gcp-secret-manager-to-dotenv"
  [plugins.inputs.variables]
  # This will make the plugin emit the value of the
  # secret named "secret-name" into the env var
  # ENVIRONMENT_VARIABLE_NAME in .env
  ENVIRONMENT_VARIABLE_NAME = "secret-name"

  [plugins.inputs.files]
  # This will write a file with the contents of the
  # "file-secret" secret into a directory generated
  # in the functions dir, and the SOME_SECRET_FILE
  # var will be populated with the path of that file.
  SOME_SECRET_FILE = "file-secret"

  # This will add the "pem" extension to the file
  # generated with the contents of the secret.
  SSL_CERT = { name = "some-cert", extension = "pem" }

  [plugins.inputs]
  # The name of the generated directory for file
  # secrets. Defaults to "secrets".
  secretdir = "secrets"
```

Unless a file secret is exposed as `GOOGLE_APPLICATION_CREDENTIALS`, the service account provided in the `GCP_SERVICE_ACCOUNT` env var will be exposed as a file in that name.

---
_Source: https://npm.io/package/netlify-plugin-gcp-secret-manager-to-dotenv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
