> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-+-++/modules/bx-google-secrets.md).

# Google Secrets +

{% hint style="danger" %}
This module is only available to [+/++ subscribers only](https://boxlang.io/plans), and requires a valid `bx-plus` license.
{% endhint %}

The `bx-google-secrets` module registers a `google` system setting provider so BoxLang can resolve secrets directly from Google Secret Manager using `getSystemSetting()`.

## ✨ Features

* Resolve secrets with `getSystemSetting( "google.SECRET_NAME" )`
* 3-tier configuration resolution per setting: `this.google` in `Application.bx`, module settings, then Google environment variables/Application Default Credentials
* In-memory TTL caching to reduce Secret Manager API calls
* Per-application `SecretManagerServiceClient` isolation when `this.google` is defined
* Automatic client cleanup on application shutdown
* Graceful fallback behavior: returns `null` on provider errors so normal `getSystemSetting()` fallback continues

## 📦 Requirements

* BoxLang 1.14+
* `bx-plus` module
* Google Cloud project with Secret Manager enabled
* Google identity with `secretmanager.versions.access` permission

## 🚀 Installation

### Via CommandBox

```bash
box install bx-plus,bx-google-secrets
```

### Via BoxLang OS Binary

```bash
install-bx-module bx-plus bx-google-secrets
```

## ⚡ Quick Start

1. Install and activate `bx-plus` and `bx-google-secrets`
2. Configure credentials through `this.google`, module settings, or Google Application Default Credentials
3. Resolve secrets with `google.` namespaced keys

```js
dbPassword = getSystemSetting( "google.DB_PASSWORD" )
apiKey = getSystemSetting( "google.API_KEY", "fallback-key" )
```

## ⚙️ Basic Configuration

Use module settings in `boxlang.json` when you want global defaults:

```json
{
  "modules": {
    "bxgoogle-secrets": {
      "settings": {
        "projectId": "my-gcp-project",
        "credentialsPath": "${GOOGLE_APPLICATION_CREDENTIALS}",
        "credentialsJson": "",
        "cacheTTL": 300
      }
    }
  }
}
```

{% hint style="info" %}
The module id for installation is `bx-google-secrets`, while module settings are keyed under `bxgoogle-secrets`.
{% endhint %}

For per-app overrides and local development examples, see [Configuration & Usage](/boxlang-+-++/modules/bx-google-secrets/configuration-and-usage.md).

## 🔍 How Secret Resolution Works

For `getSystemSetting( "google.MY_SECRET" )`, the provider:

1. Resolves effective Google settings (3-tier lookup)
2. Checks in-memory cache using `projectId:secretName`
3. Calls Google Secret Manager when cache is stale/missing
4. Caches and returns the secret value
5. Returns `null` on lookup failure, allowing standard BoxLang fallback behavior

## 🔗 Related Documentation

{% content-ref url="/pages/rlJhPAYvn35H5bd1JluL" %}
[Configuration & Usage](/boxlang-+-++/modules/bx-google-secrets/configuration-and-usage.md)
{% endcontent-ref %}

{% content-ref url="/pages/SH0cc6rebT20R5xMqjvD" %}
[Modules](/getting-started/configuration/modules.md)
{% endcontent-ref %}

{% content-ref url="/pages/XgEGjIaLVnXWP7YThMAw" %}
[Plus Core](/boxlang-+-++/modules/bx-plus.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://boxlang.ortusbooks.com/boxlang-+-++/modules/bx-google-secrets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
