v2.31.0-dev12 6a38a35

secrets.md RawHistoryFolder

Secrets Commands

Manage secrets on local or remote Gordon instances.

Remote targeting uses client config or an active remote by default. Use --remote and --token to override. See CLI Overview.

Storage depends on the secrets backend:

  • pass: secrets are stored in pass under gordon/env/<domain>/<KEY>
  • sops: secrets live in domain .env files and can reference SOPS-encrypted values
  • unsafe: secrets are stored in plain-text domain .env files

gordon secrets

Subcommands

Subcommand Description
list List all secrets for a domain
set Set a secret value
remove Remove a secret

gordon secrets list

List all secrets for a specific domain. When attachment secrets are present, they are displayed in a tree view below the domain secrets.

gordon secrets list <domain>

Arguments

Argument Description
<domain> The domain name to list secrets for

Options

Option Description
--json Output secrets as JSON
--remote, -r Remote name or URL (e.g., prod, https://gordon.mydomain.com)
--token Authentication token for remote

Examples

# Local
gordon secrets list myapp.example.com

# Remote (override)
gordon secrets list myapp.example.com --remote https://gordon.mydomain.com --token $TOKEN

Output

Secrets for app.mydomain.com

Key                       Value
DATABASE_URL              ****
API_KEY                   ****
├─ [postgres]
│  ├─ POSTGRES_USER       ****
│  └─ POSTGRES_PASSWORD   ****
└─ [redis]
   └─ REDIS_PASSWORD      ****

JSON Output

gordon secrets list app.mydomain.com --json
{
  "domain": "app.mydomain.com",
  "secrets": {
    "DATABASE_URL": "****",
    "API_KEY": "****"
  },
  "attachments": {
    "postgres": {
      "POSTGRES_USER": "****",
      "POSTGRES_PASSWORD": "****"
    },
    "redis": {
      "REDIS_PASSWORD": "****"
    }
  }
}

gordon secrets set

Set a secret value for a domain.

gordon secrets set <domain> <KEY=value>...
gordon secrets set myapp.example.com DATABASE_URL="postgres://..."

Arguments

Argument Description
<domain> The domain name to set the secret for
<KEY=value>... One or more secret key/value pairs

Options

Option Description
--attachment / -a Target an attachment service (e.g., postgres, redis)
--remote, -r Remote name or URL (e.g., prod, https://gordon.mydomain.com)
--token Authentication token for remote

Examples

# Local
gordon secrets set myapp.example.com DATABASE_URL="postgres://user:pass@postgres:5432/db"
gordon secrets set myapp.example.com API_KEY="your-api-key"

# Remote (override)
gordon secrets set myapp.example.com DATABASE_URL="$DATABASE_URL" --remote https://gordon.mydomain.com --token $TOKEN

# Set attachment secrets
gordon secrets set app.mydomain.com --attachment postgres POSTGRES_PASSWORD=secret
gordon secrets set app.mydomain.com -a redis REDIS_PASSWORD=mysecret

# Multiple secrets at once
gordon secrets set app.mydomain.com -a postgres POSTGRES_USER=admin POSTGRES_PASSWORD=secret

gordon secrets remove

Remove a secret from a domain.

gordon secrets remove <domain> <key>

Arguments

Argument Description
<domain> The domain name
<key> The secret key to remove

Options

Option Description
--attachment / -a Target an attachment service (e.g., postgres, redis)
--force Remove without confirmation
--remote, -r Remote name or URL (e.g., prod, https://gordon.mydomain.com)
--token Authentication token for remote

Examples

# Local
gordon secrets remove myapp.example.com DATABASE_URL

# Remote (override)
gordon secrets remove myapp.example.com DATABASE_URL --remote https://gordon.mydomain.com --token $TOKEN

# Remove attachment secret
gordon secrets remove app.mydomain.com --attachment postgres POSTGRES_PASSWORD

Workflow Examples

Setting Up Application Secrets

# Database connection
gordon secrets set myapp.example.com DATABASE_URL="postgres://user:pass@postgres:5432/mydb"

# API keys
gordon secrets set myapp.example.com STRIPE_KEY="sk_live_..."
gordon secrets set myapp.example.com SENDGRID_KEY="SG..."

# JWT secret
gordon secrets set myapp.example.com JWT_SECRET="your-jwt-secret-here"

# Verify
gordon secrets list myapp.example.com

CI/CD Secret Management

# In your CI/CD pipeline
export GORDON_REMOTE=https://gordon.mydomain.com
export GORDON_TOKEN=$GORDON_TOKEN

# Update secrets before deploy
gordon secrets set myapp.example.com DATABASE_URL="$DATABASE_URL"
gordon secrets set myapp.example.com API_KEY="$API_KEY"

# Deploy
gordon deploy myapp.example.com

Rotating Secrets

# Generate new secret
NEW_JWT_SECRET=$(openssl rand -base64 32)

# Update the secret
gordon secrets set myapp.example.com JWT_SECRET="$NEW_JWT_SECRET"

# Redeploy to pick up new secret
gordon deploy myapp.example.com

Attachment Secrets

# Configure database credentials
gordon secrets set app.mydomain.com -a postgres POSTGRES_USER=admin POSTGRES_PASSWORD=secret

# Configure cache credentials
gordon secrets set app.mydomain.com -a redis REDIS_PASSWORD=cache-secret

# Verify
gordon secrets list app.mydomain.com

# Redeploy to pick up new secrets
gordon deploy app.mydomain.com
source
1# Secrets Commands
2
3Manage secrets on local or remote Gordon instances.
4
5Remote targeting uses client config or an active remote by default.
6Use `--remote` and `--token` to override. See [CLI Overview](./index.md).
7
8Storage depends on the secrets backend:
9- `pass`: secrets are stored in pass under `gordon/env/<domain>/<KEY>`
10- `sops`: secrets live in domain `.env` files and can reference SOPS-encrypted values
11- `unsafe`: secrets are stored in plain-text domain `.env` files
12
13## gordon secrets
14
15### Subcommands
16
17| Subcommand | Description |
18|------------|-------------|
19| `list` | List all secrets for a domain |
20| `set` | Set a secret value |
21| `remove` | Remove a secret |
22
23---
24
25## gordon secrets list
26
27List all secrets for a specific domain. When attachment secrets are present, they are displayed in a tree view below the domain secrets.
28
29```bash
30gordon secrets list <domain>
31```
32
33### Arguments
34
35| Argument | Description |
36|----------|-------------|
37| `<domain>` | The domain name to list secrets for |
38
39### Options
40
41| Option | Description |
42|--------|-------------|
43| `--json` | Output secrets as JSON |
44| `--remote, -r` | Remote name or URL (e.g., prod, https://gordon.mydomain.com) |
45| `--token` | Authentication token for remote |
46
47### Examples
48
49```bash
50# Local
51gordon secrets list myapp.example.com
52
53# Remote (override)
54gordon secrets list myapp.example.com --remote https://gordon.mydomain.com --token $TOKEN
55```
56
57### Output
58
59```
60Secrets for app.mydomain.com
61
62Key                       Value
63DATABASE_URL              ****
64API_KEY                   ****
65├─ [postgres]
66│  ├─ POSTGRES_USER       ****
67│  └─ POSTGRES_PASSWORD   ****
68└─ [redis]
69   └─ REDIS_PASSWORD      ****
70```
71
72### JSON Output
73
74```bash
75gordon secrets list app.mydomain.com --json
76```
77
78```json
79{
80  "domain": "app.mydomain.com",
81  "secrets": {
82    "DATABASE_URL": "****",
83    "API_KEY": "****"
84  },
85  "attachments": {
86    "postgres": {
87      "POSTGRES_USER": "****",
88      "POSTGRES_PASSWORD": "****"
89    },
90    "redis": {
91      "REDIS_PASSWORD": "****"
92    }
93  }
94}
95```
96
97---
98
99## gordon secrets set
100
101Set a secret value for a domain.
102
103```bash
104gordon secrets set <domain> <KEY=value>...
105gordon secrets set myapp.example.com DATABASE_URL="postgres://..."
106```
107
108### Arguments
109
110| Argument | Description |
111|----------|-------------|
112| `<domain>` | The domain name to set the secret for |
113| `<KEY=value>...` | One or more secret key/value pairs |
114
115### Options
116
117| Option | Description |
118|--------|-------------|
119| `--attachment` / `-a` | Target an attachment service (e.g., postgres, redis) |
120| `--remote, -r` | Remote name or URL (e.g., prod, https://gordon.mydomain.com) |
121| `--token` | Authentication token for remote |
122
123### Examples
124
125```bash
126# Local
127gordon secrets set myapp.example.com DATABASE_URL="postgres://user:pass@postgres:5432/db"
128gordon secrets set myapp.example.com API_KEY="your-api-key"
129
130# Remote (override)
131gordon secrets set myapp.example.com DATABASE_URL="$DATABASE_URL" --remote https://gordon.mydomain.com --token $TOKEN
132
133# Set attachment secrets
134gordon secrets set app.mydomain.com --attachment postgres POSTGRES_PASSWORD=secret
135gordon secrets set app.mydomain.com -a redis REDIS_PASSWORD=mysecret
136
137# Multiple secrets at once
138gordon secrets set app.mydomain.com -a postgres POSTGRES_USER=admin POSTGRES_PASSWORD=secret
139```
140
141---
142
143## gordon secrets remove
144
145Remove a secret from a domain.
146
147```bash
148gordon secrets remove <domain> <key>
149```
150
151### Arguments
152
153| Argument | Description |
154|----------|-------------|
155| `<domain>` | The domain name |
156| `<key>` | The secret key to remove |
157
158### Options
159
160| Option | Description |
161|--------|-------------|
162| `--attachment` / `-a` | Target an attachment service (e.g., postgres, redis) |
163| `--force` | Remove without confirmation |
164| `--remote, -r` | Remote name or URL (e.g., prod, https://gordon.mydomain.com) |
165| `--token` | Authentication token for remote |
166
167### Examples
168
169```bash
170# Local
171gordon secrets remove myapp.example.com DATABASE_URL
172
173# Remote (override)
174gordon secrets remove myapp.example.com DATABASE_URL --remote https://gordon.mydomain.com --token $TOKEN
175
176# Remove attachment secret
177gordon secrets remove app.mydomain.com --attachment postgres POSTGRES_PASSWORD
178```
179
180---
181
182## Workflow Examples
183
184### Setting Up Application Secrets
185
186```bash
187# Database connection
188gordon secrets set myapp.example.com DATABASE_URL="postgres://user:pass@postgres:5432/mydb"
189
190# API keys
191gordon secrets set myapp.example.com STRIPE_KEY="sk_live_..."
192gordon secrets set myapp.example.com SENDGRID_KEY="SG..."
193
194# JWT secret
195gordon secrets set myapp.example.com JWT_SECRET="your-jwt-secret-here"
196
197# Verify
198gordon secrets list myapp.example.com
199```
200
201### CI/CD Secret Management
202
203```bash
204# In your CI/CD pipeline
205export GORDON_REMOTE=https://gordon.mydomain.com
206export GORDON_TOKEN=$GORDON_TOKEN
207
208# Update secrets before deploy
209gordon secrets set myapp.example.com DATABASE_URL="$DATABASE_URL"
210gordon secrets set myapp.example.com API_KEY="$API_KEY"
211
212# Deploy
213gordon deploy myapp.example.com
214```
215
216### Rotating Secrets
217
218```bash
219# Generate new secret
220NEW_JWT_SECRET=$(openssl rand -base64 32)
221
222# Update the secret
223gordon secrets set myapp.example.com JWT_SECRET="$NEW_JWT_SECRET"
224
225# Redeploy to pick up new secret
226gordon deploy myapp.example.com
227```
228
229### Attachment Secrets
230
231```bash
232# Configure database credentials
233gordon secrets set app.mydomain.com -a postgres POSTGRES_USER=admin POSTGRES_PASSWORD=secret
234
235# Configure cache credentials
236gordon secrets set app.mydomain.com -a redis REDIS_PASSWORD=cache-secret
237
238# Verify
239gordon secrets list app.mydomain.com
240
241# Redeploy to pick up new secrets
242gordon deploy app.mydomain.com
243```
244
245## Related
246
247- [CLI Overview](./index.md)
248- [Secrets Configuration](../config/secrets.md)
249- [Environment Variables](../config/env.md)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close