0.2.1 • Published 9 days ago

@neolution-ch/next-with-google-secrets v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 days ago

Configure your Node.js Applications with Google Secrets

Introduction

@neolution-ch/next-with-google-secrets starts your next application with predefined mapped google secrets in the config.

Options

NameRequiredDescriptionDefault
projectName:heavy_check_mark:Specifies which project the secrets are read from.null
mapping:heavy_check_mark:Records<string, string> to map the secrets to configuration keysnull
filterA server side filter forwarded to the google api according to https://cloud.google.com/secret-manager/docs/filteringnull
filterFnA filter function that will be run after the secrets are read from google (client side filtering). Supplies the Google.Cloud.SecretManager.V1.Secret as parameter and the name. If returned true the secret will be processed otherwise it will be ignored.{secret, name} => true
versionsBy default the latest version of each secret is taken. But you can specify a specific version in the form of a records. Key is the secret id and value is the version to take. For example: {MySecretId: "2"}null

Quick Start

npm install @neolution-ch/next-with-google-secrets

or

yarn add @neolution-ch/next-with-google-secrets

then use the available function in your next.config.js like this:

...
const { withGoogleSecrets } = require("@neolution-ch/next-with-google-secrets");
...
module.export = () =>
    withGoogleSecrets({
        projectName: "projects/your-gcp-project-name",
        mapping: { YourSecretName: "serverRuntimeConfig__yourConfigKeyYouWantToOverwrite", }
        nextConfig: YourCurrentNextConfiguration....
    });

now if you configured everything correctly, you will see this output log in your console:

WithGoogleSecrets - overritten config with gcp secret: serverRuntimeConfig__yourConfigKeyYouWantToOverwrite
0.2.1

9 days ago

0.2.0

7 months ago

0.1.0

8 months ago

0.0.1

9 months ago