basecamp / basecamp/kamal

`kamal config` not displaying env vars for roles

Open
#816 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
14.6k
Forks
752
Avg merge
4d 23h
Merged PRs (30d)
8

Description

`kamal config` mentions that it will output the combined config including secrets but it looks like they're missing for roles/servers. I'm seeing them on accessories but nothing from the global or role level.

```
kamal config # Show combined config (including secrets!)
```

With this _deploy.yml_ file:

``` yml
service: hey

image: nickhammond/hey

registry:
server: ghcr.io
username: <%= %x(gh config get -h github.com username).strip %>
password: <%= %x(gh config get -h github.com oauth_token).strip %>

env:
clear:
GLOBAL_VAR: 1
secret:
- GLOBAL_SECRET

servers:
web:
hosts:
- 867.53.0.9
env:
clear:
ROLE_VAR: true
secret:
- ROLE_SECRET

accessories:
db:
image: mysql:8.0
host: 867.53.0.9
port: 3306
env:
clear:
MYSQL_DATABASE: 'production'
MYSQL_ROOT_HOST: '%'
secret:
- MYSQL_ROOT_PASSWORD
directories:
- data:/var/lib/mysql
```

`kamal config` output is this:
``` yml
---
:roles:
- web
:hosts:
- 867.53.0.9
:primary_host: 867.53.0.9
:version: HEAD
:repository: ghcr.io/nickhammond/hey
:absolute_image: ghcr.io/nickhammond/hey:HEAD
:service_with_version: hey-HEAD
:volume_args: []
:ssh_options:
:user: root
:port: 22
:keepalive: true
:keepalive_interval: 30
:log_level: :fatal
:sshkit: {}
:builder: {}
:accessories:
db:
image: mysql:8.0
host: 867.53.0.9
port: 3306
env:
clear:
MYSQL_DATABASE: production
MYSQL_ROOT_HOST: "%"
secret:
- MYSQL_ROOT_PASSWORD
directories:
- data:/var/lib/mysql
:logging:
- "--log-opt"
- max-size="10m"
:healthcheck:
path: "/up"
port: 3000
max_attempts: 7
exposed_port: 3999
cord: "/tmp/kamal-cord"
log_lines: 50
```

I would expect to see `GLOBAL_VAR`, `GLOBAL_SECRET`, `ROLE_VAR`, and `ROLE_SECRET` in this output but it's missing.

It might be related to https://github.com/basecamp/kamal/issues/803 but slightly different.

Happy to have a go at it but just wanted to mention it first. I was trying to troubleshoot some env var loading and remembered this command existed but haven't used it in a while.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `kamal config` with the provided `deploy.yml`, comparing the global and role-level `env` sections with the accessory output. Trace the `kamal config` entry point and how role/server configuration is assembled, then verify that GLOBAL_VAR, GLOBAL_SECRET, ROLE_VAR, and ROLE_SECRET appear in the combined output.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.