mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 13:56:57 +00:00
use some opts via environment vars
This commit is contained in:
parent
a961655d2c
commit
a211ecee0d
2 changed files with 16 additions and 4 deletions
|
@ -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
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue