How to keep track of array values?

1. The problem I’m having:

Dynamically populated “handle” array within a server directive is difficult to manage. For example add 100 items, then i want to edit item 52. Using the @id tag is unreliable because Caddy allows me to add multiple identical @id values.

I’m looking for something like a key/value reference that I can later re-visit to update a setting down the line.

2. Error messages and/or full log output:

n/a

3. Caddy version: 2.7.5

4. How I installed and ran Caddy: apt

a. System environment: Ubuntu

b. Command:

/usr/bin/caddy run --environ --config /etc/caddy/config.json

c. Service/unit/compose file:

[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target

[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/config.json
ExecReload=/usr/bin/caddy reload --config /etc/caddy/config.json --force
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

d. My complete Caddy config:

{
    "apps": {
        "http": {
            "http_port": 8080,
            "https_port": 4343,
            "servers": {
                "srv0" : {
                    "listen" : [":8080"],
                    "routes" : []
                }
            }
        }
    }
}

5. Links to relevant resources:

I’m not sure I totally understand what you’re asking, but why is @id untenable for you?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.