多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.3 KiB

---
title: 'Updating Secrets'
description: 'Learn how to update secrets in NocoDB using the nc-secret-mgr package.'
tags: ['Secrets', 'nc-secret-mgr', 'Update', 'Security']
keywords: ['NocoDB secrets', 'nc-secret-mgr', 'Update', 'Security']
---
## Updating Secrets
To update a secret in NocoDB, you can use the `nc-secret-mgr` package. Follow the steps below to update a secret:
### Using the Command Line Interface (CLI)
1. Install the `nc-secret-mgr` package if you haven't already. You can do this by running the following command in your terminal:
```bash
npm install -g nc-secret-mgr
```
2. Once the package is installed, you can update a secret by running the following command:
```bash
NC_DB="pg://host:port?u=user&p=password&d=database" nc-secret-mgr update --prev <previous-secret> --new <new-secret>
```
OR
```bash
NC_DB="pg://host:port?u=user&p=password&d=database" nc-secret-mgr <previous-secret> <new-secret>
```
2 months ago
Replace `<previous-secret>` with the name of the secret you used previously, and `<new-secret>` with the new value of the secret.
3. After running the command, the secret will be updated in NocoDB.
### Using Executables
Alternatively, you can use the `nc-secret-mgr` executable to update secrets.
1. Download the `nc-secret-mgr` executable from the [NocoDB Github](https://github.com/nocodb/nc-secret-mgr/releases/latest).
2. Run the executable using the following command:
```bash
NC_DB="pg://host:port?u=user&p=password&d=database" ./nc-secret-mgr-macos-arm64 update --prev <previous-secret> --new <new-secret>
```
Replace `<previous-secret>` with the name of the secret you used previously, and `<new-secret>` with the new value of the secret.
3. After running the command, the secret will be updated in NocoDB.
Note: All environment variables are supported, including `NC_DB`, `NC_DB_JSON`, `NC_DB_JSON_FILE`, `DATABASE_URL`, and `DATABASE_URL_FILE`. You can use any of these variables to specify your database connection. Alternatively, you can use the following equivalent parameters.
| Environment Variable | CLI Parameter |
| --------------------- | -------------- |
| `NC_DB` | `--nc-db` |
| `NC_DB_JSON` | `--nc-db-json` |
| `NC_DB_JSON_FILE` | `--nc-db-json-file` |
| `DATABASE_URL` | `--database-url` |
| `DATABASE_URL_FILE` | `--database-url-file` |