2021-02-17 07:20:19 +03:00
|
|
|
package testutil
|
|
|
|
|
2021-03-08 14:59:35 +03:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
2021-04-05 17:00:21 +03:00
|
|
|
"runtime"
|
2021-03-08 14:59:35 +03:00
|
|
|
)
|
|
|
|
|
2021-02-17 07:20:19 +03:00
|
|
|
// this can be overridden by ldflags
|
|
|
|
var (
|
2021-06-03 16:26:28 +03:00
|
|
|
HasuraDockerImage = func() string {
|
|
|
|
graphqlEngineDockerImage := os.Getenv("HASURA_TEST_CLI_HGE_DOCKER_IMAGE")
|
|
|
|
if graphqlEngineDockerImage != "" {
|
|
|
|
return graphqlEngineDockerImage
|
2021-05-17 03:29:11 +03:00
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}()
|
2021-06-03 16:26:28 +03:00
|
|
|
|
2021-06-18 09:24:16 +03:00
|
|
|
TestAdminSecret = os.Getenv("HASURA_GRAPHQL_TEST_ADMIN_SECRET")
|
|
|
|
|
2021-04-05 17:00:21 +03:00
|
|
|
DockerSwitchIP = func() string {
|
|
|
|
switch runtime.GOOS {
|
|
|
|
case "darwin", "windows":
|
|
|
|
return "host.docker.internal"
|
|
|
|
}
|
2021-04-12 20:27:33 +03:00
|
|
|
return "172.17.0.1"
|
2021-04-05 17:00:21 +03:00
|
|
|
}()
|
2021-05-17 03:29:11 +03:00
|
|
|
Hostname = "localhost"
|
|
|
|
BaseURL = fmt.Sprintf("http://%s", Hostname)
|
|
|
|
MSSQLPassword = "MSSQLp@ssw0rd"
|
|
|
|
CLIBinaryPath = func() string {
|
|
|
|
if os.Getenv("CI") == "true" {
|
|
|
|
return "/build/_cli_output/binaries/cli-hasura-linux-amd64"
|
|
|
|
}
|
|
|
|
|
|
|
|
hasuraCliPathEnv := os.Getenv("HASURA_TEST_CLI_PATH")
|
|
|
|
if hasuraCliPathEnv != "" {
|
|
|
|
return hasuraCliPathEnv
|
2021-03-08 14:59:35 +03:00
|
|
|
}
|
2021-05-17 03:29:11 +03:00
|
|
|
|
|
|
|
return "hasura"
|
2021-03-08 14:59:35 +03:00
|
|
|
}()
|
2021-02-17 07:20:19 +03:00
|
|
|
)
|