Skip to content

Commit

Permalink
add base url for ce service dynamically
Browse files Browse the repository at this point in the history
Signed-off-by: encalada <[email protected]>
  • Loading branch information
karanibm6 authored and qu1queee committed Mar 12, 2024
1 parent 1f1b234 commit c660cad
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion kafka-observer/cmd/observer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"os/signal"
"strconv"
"strings"
"sync"
"syscall"
"time"
Expand Down Expand Up @@ -244,9 +245,16 @@ func GetCodeengineService(ceConfig cmd.CEClient) (*codeenginev2.CodeEngineV2, er
URL: "https://iam.cloud.ibm.com",
}

baseUrl := strings.ReplaceAll(os.Getenv("CE_API_BASE_URL"), "private.", "")
if baseUrl == "" {
baseUrl = codeenginev2.DefaultServiceURL
} else {
baseUrl = baseUrl + "/v2"
}

codeEngineService, err := codeenginev2.NewCodeEngineV2(&codeenginev2.CodeEngineV2Options{
Authenticator: authenticator,
URL: "https://api.au-syd.codeengine.cloud.ibm.com/v2", //TODO: needs to be dynamic configurable
URL: baseUrl,
})
if err != nil {
log.Printf("NewCodeEngineV2 error: %s\n", err.Error())
Expand Down

0 comments on commit c660cad

Please sign in to comment.