Refactor server config: single --config flag replaces --secrets/--mail-perms

- New server/config.mjs loads config.json, resolves secrets path relative
  to config dir, returns users/smtp/mail_perms_path/bind/port
- server/secrets.mjs removed (logic absorbed into config.mjs)
- smtp moves from secrets.json to config.json
- secrets.json now contains only users (pure credentials)
- config.example.json added as reference template
- .gitignore/.npmignore updated to cover config.json and mail-perms.json
- README updated with new setup and flags

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 23:16:30 +00:00
parent d06e11197a
commit ba8c0701f8
8 changed files with 113 additions and 50 deletions

View File

@@ -49,6 +49,28 @@ ccc-keygen --filter agent --output agent-secrets.json
The full `secrets.json` stays on the host. `agent-secrets.json` goes into the container.
### Create a config file
Copy [`config.example.json`](config.example.json) to `config.json` and edit it:
```json
{
"secrets": "../secrets.json",
"mail_perms": "mail-perms.json",
"smtp": {
"host": "smtp.example.com",
"port": 587,
"secure": false,
"auth": { "user": "relay@example.com", "pass": "<password>" },
"from": "agent@example.com"
},
"bind": "127.0.0.1",
"port": 3015
}
```
`secrets` and `mail_perms` paths are resolved relative to the config file. `smtp`, `mail_perms`, `bind`, and `port` are all optional.
---
## Running
@@ -56,24 +78,22 @@ The full `secrets.json` stays on the host. `agent-secrets.json` goes into the co
### Server (host)
```bash
ccc-server --secrets secrets.json
ccc-server --secrets secrets.json --mail-perms mail-perms.json
ccc-server --config config.json
ccc-server --config config.json --dry-run
```
Server flags:
| Flag | Env variable | Description |
|------|-------------|-------------|
| `--secrets <path>` | | Path to secrets file (required) |
| `--bind <addr>` | `CONDUIT_BIND` | Address to bind to (default `127.0.0.1`) |
| `--mail-perms <path>` | `CONDUIT_MAIL_PERMS` | File to persist mail permissions (optional; in-memory only if omitted) |
| `--config <path>` | `CONDUIT_CONFIG` | Path to config file (required) |
| `--dry-run` | — | Log all action invocations but do not execute them |
Server environment variables:
| Variable | Default | Description |
|----------|---------|-------------|
| `CONDUIT_PORT` | `3015` | Port to listen on |
| `CONDUIT_BIND` | `127.0.0.1` | Address to bind to |
| `CONDUIT_ROOT` | `/workspace` | Label printed at startup (informational only — path resolution uses `VOLUME_MAPPING` in `server/helpers.mjs`) |
Server environment variables (override config file values):
| Variable | Description |
|----------|-------------|
| `CONDUIT_PORT` | Port to listen on |
| `CONDUIT_BIND` | Address to bind to |
| `CONDUIT_ROOT` | Label printed at startup (informational only — path resolution uses `VOLUME_MAPPING` in `server/helpers.mjs`) |
### Client (container / agent)