Skip to content

Commit

Permalink
fix-default-build-service-url
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Chacin <[email protected]>
  • Loading branch information
pablochacin committed Feb 11, 2025
1 parent 7af0f6f commit cbbe3f9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,18 @@ func newState(levelVar *slog.LevelVar) *state {
func (s *state) persistentPreRunE(cmd *cobra.Command, _ []string) error {
var err error

s.Options.BuildServiceURL = defaultBuildServiceURL
if len(s.buildServiceURL) > 0 {
s.Options.BuildServiceURL = s.buildServiceURL
// get URL to build service: first provided from flag, then from environment variable, then default
buildServiceURL := s.buildServiceURL

if len(buildServiceURL) == 0 {
buildServiceURL = os.Getenv("K6_BUILD_SERVICE_URL") //nolint:forbidigo
}
if len(buildServiceURL) == 0 {
buildServiceURL = defaultBuildServiceURL
}

s.Options.BuildServiceURL = buildServiceURL

// get authorization token for the build service
auth := os.Getenv("K6_CLOUD_TOKEN") //nolint:forbidigo

Expand Down

0 comments on commit cbbe3f9

Please sign in to comment.