# HashiCorp Vault

- Published on Sep 17, 2024
- 1 minute(s) read

This article walks you through the steps required to integrate HashiCorp Vault with Hyperscience.

## Configure HashiCorp Vault

To configure the HashiCorp Vault integration, follow the steps below:

1. In Vault, create a new authentication token for Hyperscience by following the steps in Vault’s [token create](https://www.vaultproject.io/docs/commands/token/create) documentation. Apply the appropriate token configuration as per your organization's policies.

2. In the _config.hcl_ file, map any secrets to be retrieved to the appropriate environment variable. See the “ [Configure config.hcl](https://help.hyperscience.ai/deployment/docs/hashicorp-vault#configure-confighcl)” section below for more information.

3. In the “.env” file, set _VAULT_ADDR_ and _VAULT_TOKEN_ to their appropriate values. If your Vault deployment requires TLS, configure the following additional environment variables:
   - _VAULT_CACERT_
   - _VAULT_CAPATH_
   - _VAULT_CLIENT_CERT_
   - _VAULT_CLIENT_KEY_
     - To learn more about Vault’s environment variables, see HashiCorp’s [Environment variable](https://www.vaultproject.io/docs/commands#environment-variables)

4. Confirm that the tool works outside of Hyperscience.

5. In the “.env” file, add the following variables and values:

```plaintext
   HS_SECRETS_MANAGER=vault
   VAULT_ADDR=http://vault.example.com:8200
   VAULT_TOKEN=
   ```

6. Restart the Hyperscience application with the following commands. Make sure that the commands work as expected.

```plaintext
   sudo bash run.sh init
   sudo bash run.sh --restart --clean
   ```

7. Rotate the secrets and restart the application with the above commands again. Make sure that the Hyperscience application starts successfully upon restart.

### Configure _config.hcl_

The _config.hcl_ file defines a format for mapping an environment variable to a location where a secret is stored.

```powershell
{path = "hs"
no_prefix = true}
```

In the example above, _path_ instructs the application to read all key/value pairs under the _hs_ prefix in Vault and return the key/value pairs as environment variables to Hyperscience. To learn more about the _config.hcl_ file, see HashiCorp’s [Configuration File](https://github.com/hashicorp/envconsul#configuration-file) guide.
