The caddy-with-dns package used a fixed-output derivation with an outputHash that bundled xcaddy source generation and go mod vendor into a single content-addressed blob. This hash broke whenever nixpkgs updated the caddy version, plugin versions changed, or any transitive dependency shifted, causing CI lockfile update jobs to fail. Replaced the xcaddy-based build with a standard Go module structure using buildGoModule. The source files (main.go, go.mod, go.sum) are checked in and the caddy version is pinned in go.mod rather than inherited from nixpkgs, decoupling from flake.lock updates. The package version is extracted from go.mod at eval time to avoid maintaining it separately. Removed the separate caddy-specific CI build step that existed only to catch stale hashes. Added a Renovate post-upgrade task to recompute the vendorHash after Go dependency updates, and added gawk and gnused to the Renovate service path so the post-upgrade sed and awk commands work. Test plan: - Built caddy-with-dns, verified binary version (v2.10.2) and both dns.providers.cloudflare and dns.providers.jakehillion modules - CI
48 lines
937 B
Go
48 lines
937 B
Go
package jakehillion
|
|
|
|
import (
|
|
"github.com/caddyserver/caddy/v2"
|
|
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
|
|
)
|
|
|
|
func init() {
|
|
caddy.RegisterModule(Provider{})
|
|
}
|
|
|
|
// CaddyModule returns the Caddy module information.
|
|
func (Provider) CaddyModule() caddy.ModuleInfo {
|
|
return caddy.ModuleInfo{
|
|
ID: "dns.providers.jakehillion",
|
|
New: func() caddy.Module { return new(Provider) },
|
|
}
|
|
}
|
|
|
|
// UnmarshalCaddyfile sets up the DNS provider from Caddyfile tokens.
|
|
//
|
|
// Syntax:
|
|
//
|
|
// jakehillion {
|
|
// api_endpoint <url>
|
|
// }
|
|
func (p *Provider) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
|
for d.Next() {
|
|
for d.NextBlock(0) {
|
|
switch d.Val() {
|
|
case "api_endpoint":
|
|
if !d.NextArg() {
|
|
return d.ArgErr()
|
|
}
|
|
p.APIEndpoint = d.Val()
|
|
default:
|
|
return d.Errf("unrecognized subdirective: %s", d.Val())
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Interface guards
|
|
var (
|
|
_ caddyfile.Unmarshaler = (*Provider)(nil)
|
|
)
|