all repos — flynet @ 30da3dc0374d2c3da1b9d69dd4464a3b6eb21726

ersatz CDN on fly.io

check-hostnames (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env fish
set --local to_provision $(
    join -v1 \
        (awk '
            /^[a-z]/ {
                gsub(/,/, "");
                gsub(/ {/, "");
                gsub(/[[:space:]]+/, "\n");
                if ($1 !~ /fly\.dev/) {
                    print
                }
            }
        ' Caddyfile | sort | psub) \
        (fly certs list --json | fx @.hostname list | sort | psub)
)

if set --query to_provision[1]
    echo "Setup required for hostnames: $to_provision"
    echo

    for name in $to_provision
        if test -z (kdig +short TXT _fly-ownership.$name)
            fly certs add $name
            fly certs remove --acme --yes $name
        else
            echo Add the hostname to DNS, then run
            echo fly certs add $name
            echo fly certs remove --acme --yes $name
        end

        echo
    end
end