diff --git a/.woodpecker.yml b/.woodpecker.yml index e240f6a..f3ad17e 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -31,3 +31,8 @@ pipeline: detach: true commands: - go test -tags integration codeberg.org/codeberg/pages/integration/... + environment: + - ACME_API=https://acme.mock.directory + - PAGES_DOMAIN=localhost.mock.directory + - RAW_DOMAIN=raw.localhost.mock.directory + - PORT=4430 \ No newline at end of file diff --git a/integration/main_test.go b/integration/main_test.go index 0ad4712..4564773 100644 --- a/integration/main_test.go +++ b/integration/main_test.go @@ -3,6 +3,7 @@ package integration import ( "context" "log" + "os" "testing" "time" @@ -31,11 +32,11 @@ func startServer(ctx context.Context) error { args := []string{ "--verbose", "--acme-accept-terms", "true", - "--acme-api-endpoint", "https://acme.mock.directory", - "--pages-domain", "localhost.mock.directory", - "--raw-domain", "raw.localhost.mock.directory", - "--port", "4430", } + setEnvIfNotSet("ACME_API", "https://acme.mock.directory") + setEnvIfNotSet("PAGES_DOMAIN", "localhost.mock.directory") + setEnvIfNotSet("RAW_DOMAIN", "raw.localhost.mock.directory") + setEnvIfNotSet("PORT", "4430") app := cli.NewApp() app.Name = "pages-server" @@ -46,3 +47,9 @@ func startServer(ctx context.Context) error { return nil } + +func setEnvIfNotSet(key, value string) { + if _, set := os.LookupEnv(key); !set { + os.Setenv(key, value) + } +}