Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
adelinag08 committed Mar 5, 2024
1 parent 6b60fa2 commit 9eeb2d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
1 change: 0 additions & 1 deletion pkg/cmd/util/token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,4 @@ func (p *Provider) GetToken() (string, error) {
}

return p.token, nil

}
22 changes: 14 additions & 8 deletions pkg/cmdutil/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ func initClaimService(env, boxerClaimURL string, authService token.AuthService)
if err != nil {
return nil, fmt.Errorf("unable to create token provider: %w", err)
}
url := processURL(boxerClaimURL, env)
config := claim.Config{
ClaimURL: fmt.Sprintf(boxerClaimURL, env),
ClaimURL: url,
GetTokenFunc: tp.GetToken,
}
claimService, err := claim.New(config)
Expand All @@ -100,8 +101,9 @@ func initAlgorithmService(env, crystalURL string, authService token.AuthService)
if err != nil {
return nil, fmt.Errorf("unable to create token provider: %w", err)
}
url := processURL(crystalURL, env)
config := algorithm.Config{
SchedulerURL: fmt.Sprintf(crystalURL, env),
SchedulerURL: url,
APIVersion: "v1.2",
GetTokenFunc: tp.GetToken,
}
Expand All @@ -118,12 +120,7 @@ func initSparkService(env, beastURL string, authService token.AuthService) (*spa
if err != nil {
return nil, fmt.Errorf("unable to create token provider: %w", err)
}
url := beastURL
var s1, s2 string
_, err = fmt.Sscanf(url, "%s%s", &s1, &s2)
if err == nil {
url = fmt.Sprintf(beastURL, env)
}
url := processURL(beastURL, env)
config := spark.Config{
BaseURL: url,
GetTokenFunc: tp.GetToken,
Expand All @@ -134,5 +131,14 @@ func initSparkService(env, beastURL string, authService token.AuthService) (*spa
return nil, fmt.Errorf("failed to create spark service: %w", err)
}
return sparkService, nil
}

func processURL(url, env string) string {
var s1, s2 string
_, err := fmt.Sscanf(url, "%s%s", &s1, &s2)
if err == nil {
url = fmt.Sprintf(url, env)
return url
}
return url
}

0 comments on commit 9eeb2d1

Please sign in to comment.