mirror of
https://github.com/caddyserver/caddy.git
synced 2026-05-27 01:02:29 -04:00
ef496e58ef
Tests / test (s390x on IBM Z) (push) Has been skipped
Tests / goreleaser-check (push) Has been skipped
Cross-Build / build (~1.26.0, 1.26, aix) (push) Failing after 1m41s
Cross-Build / build (~1.26.0, 1.26, dragonfly) (push) Failing after 1m44s
Tests / test (./cmd/caddy/caddy, ~1.26.0, ubuntu-latest, 0, 1.26, linux) (push) Failing after 2m45s
Cross-Build / build (~1.26.0, 1.26, freebsd) (push) Successful in 4m1s
Cross-Build / build (~1.26.0, 1.26, netbsd) (push) Successful in 1m26s
Cross-Build / build (~1.26.0, 1.26, linux) (push) Successful in 2m38s
Cross-Build / build (~1.26.0, 1.26, solaris) (push) Successful in 1m28s
Cross-Build / build (~1.26.0, 1.26, darwin) (push) Successful in 6m2s
Cross-Build / build (~1.26.0, 1.26, illumos) (push) Successful in 4m33s
Cross-Build / build (~1.26.0, 1.26, openbsd) (push) Successful in 2m31s
Cross-Build / build (~1.26.0, 1.26, windows) (push) Successful in 2m39s
Lint / dependency-review (push) Failing after 1m22s
Lint / lint (ubuntu-latest, linux) (push) Failing after 2m13s
Lint / govulncheck (push) Successful in 2m53s
OpenSSF Scorecard supply-chain security / Scorecard analysis (push) Failing after 6m41s
Tests / test (./cmd/caddy/caddy, ~1.26.0, macos-14, 0, 1.26, mac) (push) Has been cancelled
Tests / test (./cmd/caddy/caddy.exe, ~1.26.0, windows-latest, True, 1.26, windows) (push) Has been cancelled
Lint / lint (macos-14, mac) (push) Has been cancelled
Lint / lint (windows-latest, windows) (push) Has been cancelled
* caddytls: Expand ACME credentials
This allows using global placeholders such as {file./run/secrets/key_id}
when setting up the tls configuration.
* chore(formatting): gofmt on acmeissuer_test
44 lines
1.4 KiB
Go
44 lines
1.4 KiB
Go
package caddytls
|
|
|
|
import (
|
|
"github.com/caddyserver/caddy/v2"
|
|
"github.com/mholt/acmez/v3/acme"
|
|
"testing"
|
|
)
|
|
|
|
func TestACMEIssuerExpandPlaceholders(t *testing.T) {
|
|
t.Setenv("CADDY_TEST_CA_URL", "https://acme.example.com/directory")
|
|
t.Setenv("CADDY_TEST_TEST_CA_URL", "https://acme2.example.com/directory")
|
|
t.Setenv("CADDY_TEST_EAB_KEY_ID", "example-key-id")
|
|
t.Setenv("CADDY_TEST_EAB_MAC_KEY", "example-mac-key")
|
|
|
|
caddyCtx, cancel := caddy.NewContext(caddy.Context{Context: t.Context()})
|
|
defer cancel()
|
|
|
|
iss := &ACMEIssuer{
|
|
CA: "{env.CADDY_TEST_CA_URL}",
|
|
TestCA: "{env.CADDY_TEST_TEST_CA_URL}",
|
|
ExternalAccount: &acme.EAB{
|
|
KeyID: "{env.CADDY_TEST_EAB_KEY_ID}",
|
|
MACKey: "{env.CADDY_TEST_EAB_MAC_KEY}",
|
|
},
|
|
}
|
|
|
|
if err := iss.Provision(caddyCtx); err != nil {
|
|
t.Fatalf("Provision() returned unexpected error: %v", err)
|
|
}
|
|
|
|
if want := "https://acme.example.com/directory"; iss.CA != want {
|
|
t.Errorf("CA: got %q, want %q", iss.CA, want)
|
|
}
|
|
if want := "https://acme2.example.com/directory"; iss.TestCA != want {
|
|
t.Errorf("TestCA: got %q, want %q", iss.TestCA, want)
|
|
}
|
|
if want := "example-key-id"; iss.ExternalAccount.KeyID != want {
|
|
t.Errorf("ExternalAccount.KeyID: got %q, want %q", iss.ExternalAccount.KeyID, want)
|
|
}
|
|
if want := "example-mac-key"; iss.ExternalAccount.MACKey != want {
|
|
t.Errorf("ExternalAccount.MACKey: got %q, want %q", iss.ExternalAccount.MACKey, want)
|
|
}
|
|
}
|