Skip to content

Commit

Permalink
feat: subdomain-url in entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta committed Mar 21, 2023
1 parent a9964a3 commit f94c7e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ test-kubo-subdomains: provision-kubo gateway-conformance
"Paths": ["/ipfs", "/ipns", "/api"] \
} \
}'
# todo: SUBDOMAIN_GATEWAY_URL should be a cmd parameter
./gateway-conformance test --json output.json --gateway-url ${GATEWAY_URL} --subdomain-url ${SUBDOMAIN_GATEWAY_URL} --specs +subdomain-gateway
./gateway-conformance test --json output.json --gateway-url http://127.0.0.1:8080 --subdomain-url http://example.com:8080 --specs +subdomain-gateway

test-kubo: provision-kubo
GATEWAY_URL=http://127.0.0.1:8080 make _test
Expand Down
12 changes: 12 additions & 0 deletions cmd/gateway-conformance/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func copyFiles(inputPaths []string, outputDirectoryPath string) error {

func main() {
var gatewayURL string
var subdomainGatewayURL string
var jsonOutput string
var specs string
var directory string
Expand All @@ -78,6 +79,12 @@ func main() {
Value: "http://localhost:8080",
Destination: &gatewayURL,
},
&cli.StringFlag{
Name: "subdomain-url",
Usage: "The Subdomain URL of the IPFS Gateway implementation to be tested.",
Value: "http://example.com:8080",
Destination: &subdomainGatewayURL,
},
&cli.StringFlag{
Name: "json-output",
Aliases: []string{"json", "j"},
Expand Down Expand Up @@ -107,6 +114,11 @@ func main() {
cmd := exec.Command("go", args...)
cmd.Dir = tooling.Home()
cmd.Env = append(os.Environ(), fmt.Sprintf("GATEWAY_URL=%s", gatewayURL))

if subdomainGatewayURL != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("SUBDOMAIN_GATEWAY_URL=%s", subdomainGatewayURL))
}

cmd.Stdout = out{output}
cmd.Stderr = os.Stderr
testErr := cmd.Run()
Expand Down

0 comments on commit f94c7e9

Please sign in to comment.