> npm i @roit/roit-secret-manager
We need to grant permissions to the service account to be able to access Secret Manager
In the env.yaml
file add the secretManager.projectId
attribute, with the name do project gcp:
dev:
secretManager:
projectId: project-gcp
import { getSecretVersion } from "@roit/roit-secret-manager";
const secret = await createAndAccessSecret('secret-id', 'data')
const secret = await addSecretVersion('secret-id', 'data')
const secret = await getSecretVersion('secret-id', '1')
const secret = await disableSecretVersion('secret-id', '1')
Name | Description |
---|---|
createAndAccessSecret |
create secret and version |
getSecretVersion |
returns data of the informed version |
disableSecretVersion |
disable version of the given secret |
addSecretVersion |
add a new version to the existing secret |