1.0.2 • Published 3 months ago

gcp-secret-env v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 months ago

gcp-secret-env

Description

This is a simple cli utility to load secrets from GCP Secret Manager and set them as environment variables (.env file) in your local development environment. You can also use it to load secrets from GCP Secret Manager and set them as environment variables in your CI/CD pipeline.

Usage

Get the latest version

you need you project id and the secret name to get the latest version of the secret (projects//secrets/)

   $ npx gcp-secret-env -id <project-id> -name <secret-name>

Get a specific version

   $ npx gcp-secret-env -id <project-id> -name <secret-name> -version <version>

Create a new version based on your .env file

   $ npx gcp-secret-env -id <project-id> -name <secret-name> -save

Disable a secret

you can disable a secret by using the -disable flag followed by the secret version. if entered a negative number, you will decriment the version number by that number, otherwise you will disable the version number entered. Attention: if you want to disable the latest version, but you don't know the version number, you must use the -disable flag fowllowed by "latest".

example:

// this will disable the latest version

   $ npx gcp-secret-env -id <project-id> -name <secret-name> -disable latest

// this will disable previous version

   $ npx gcp-secret-env -id <project-id> -name <secret-name> -disable -1

// this will disable version 3

   $ npx gcp-secret-env -id <project-id> -name <secret-name> -disable 3

Destroy a secret

you can destroy a secret by using the -destroy flag followed by the secret version. works the same as the -disable flag.

example:

// this will destroy the latest version

   $ npx gcp-secret-env -id <project-id> -name <secret-name> -destroy latest

// this will destroy previous version

   $ npx gcp-secret-env -id <project-id> -name <secret-name> -destroy -1

// this will destroy version 3

   $ npx gcp-secret-env -id <project-id> -name <secret-name> -destroy 3

you can use -destroy, -disable and -save flags together.

example:

// this will create a new version based on your .env file, disable the previous version and destroy the version before that.

   $ npx gcp-secret-env -id <project-id> -name <secret-name> -save -disable -1 -destroy -2
1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago