# Configuring Connections

{% hint style="info" %}
You'll need to restart OffShoot to apply any changes made with these commands.
{% endhint %}

Connections are stored in these keys:

* `S3AwsConnections`
* `S3GenericConnections`

A connection is structured using the following JSON format:

```json
[
  {
    "path" : "",
    "label" : "",
    "endpoint" : "https://s3.eu-central-1.amazonaws.com",
    "bucket_name" : "bucket-name",
    "accessKey" : "ACCESSKEY"
  }
]
```

## Creating a connection

You can create an AWS S3 connection from a JSON file using the structure listed above with the following Terminal command:

{% code overflow="wrap" %}

```sh
defaults write nl.syncfactory.Hedge.Mac S3AwsConnections -string "$(cat /path/to/file.json)"
```

{% endcode %}

The connection's `Secret Access Key` is stored in the login Keychain as an Application password item, which you can create with the following command:

{% code overflow="wrap" %}

```sh
sudo security add-generic-password -a "ACCESSKEY" -s "https://s3.eu-central-1.amazonaws.com/bucket-name" -l "https://s3.eu-central-1.amazonaws.com" -w "secret-access-key" -T "/Applications/OffShoot.app"
```

{% endcode %}

<figure><img src="https://1060439511-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LStRji2w1AYja1bLBFv%2Fuploads%2F4dD3PrCX1c4vvOkgc8HQ%2Fimage.png?alt=media&#x26;token=f9813402-1562-4654-a3d4-9999f5b2c342" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Although OffShoot was allowed access when creating the keychain item, permissions must be allowed again. Please let us know if you discover how to fix this issue.
{% endhint %}

<figure><img src="https://1060439511-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LStRji2w1AYja1bLBFv%2Fuploads%2FE9Q1964mvJeyz98ZnRDX%2Falert.png?alt=media&#x26;token=c85952eb-02a1-4073-aea5-d39fceb62b3c" alt=""><figcaption></figcaption></figure>

## Checking existing AWS S3 locations

```sh
defaults read nl.syncfactory.Hedge.Mac S3AwsConnections
```

## Write current S3 connections to a JSON file

(For backing up or editing the JSON file.)

```sh
defaults read nl.syncfactory.Hedge.Mac S3AwsConnections > `/path/to/jsonname.json`
```
