Skip to content

Commit

Permalink
[GEN-2026] chore: switch flag to legacy (#1992)
Browse files Browse the repository at this point in the history
This pull request involves renaming the "beta" UI references to "legacy"
across the codebase for better clarity. The changes primarily affect the
`cli/cmd/ui.go` and `frontend/main.go` files.

Key changes include:

### Renaming "beta" to "legacy" in `cli/cmd/ui.go`:

* Changed `betaDefaultPort` to `legacyDefaultPort` in the constants
section.
* Updated the flag from `betaFlag` to `legacyFlag` and adjusted the
logic to use `legacyDefaultPort` instead of `betaDefaultPort`.

### Renaming "beta" to "legacy" in `frontend/main.go`:

* Changed `betaPort` to `legacyPort` in the constants section.
* Updated the flag from `beta-port` to `legacy-port` in the `parseFlags`
function.
* Modified the log messages and server start logic to use `legacyPort`
instead of `betaPort`.

---------

Co-authored-by: alonkeyval <[email protected]>
  • Loading branch information
alonkeyval and alonbraymok authored Dec 15, 2024
1 parent fc8ed14 commit b737013
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
10 changes: 5 additions & 5 deletions cli/cmd/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
)

const (
defaultPort = 3000
betaDefaultPort = 3001
defaultPort = 3000
legacyDefaultPort = 3001
)

// uiCmd represents the ui command
Expand All @@ -50,12 +50,12 @@ var uiCmd = &cobra.Command{
}
}

betaFlag, _ := cmd.Flags().GetBool("beta")
legacyFlag, _ := cmd.Flags().GetBool("legacy")
localPort := cmd.Flag("port").Value.String()
clusterPort := defaultPort

if betaFlag {
clusterPort = betaDefaultPort
if legacyFlag {
clusterPort = legacyDefaultPort
}

localAddress := cmd.Flag("address").Value.String()
Expand Down
16 changes: 7 additions & 9 deletions frontend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ import (

const (
defaultPort = 3000
betaPort = 3001
legacyPort = 3001
)

type Flags struct {
Version bool
Address string
Port int
BetaPort int
LegacyPort int
Debug bool
KubeConfig string
Namespace string
Expand All @@ -68,7 +68,7 @@ func parseFlags() Flags {
flag.BoolVar(&flags.Version, "version", false, "Print Odigos UI version.")
flag.StringVar(&flags.Address, "address", "localhost", "Address to listen on")
flag.IntVar(&flags.Port, "port", defaultPort, "Port to listen on")
flag.IntVar(&flags.BetaPort, "beta-port", betaPort, "Port to listen on for beta UI")
flag.IntVar(&flags.LegacyPort, "legacy-port", legacyPort, "Port to listen on for legacy UI")
flag.BoolVar(&flags.Debug, "debug", false, "Enable debug mode")
flag.StringVar(&flags.KubeConfig, "kubeconfig", defaultKubeConfig, "Path to kubeconfig file")
flag.StringVar(&flags.Namespace, "namespace", consts.DefaultOdigosNamespace, "Kubernetes namespace where Odigos is installed")
Expand Down Expand Up @@ -334,20 +334,18 @@ func main() {
r.GET("/api/events", sse.HandleSSEConnections)
d.GET("/api/events", sse.HandleSSEConnections)

log.Println("Starting Odigos UI...")
log.Printf("Odigos UI is available at: http://%s:%d", flags.Address, flags.BetaPort)
log.Printf("Odigos UI is available at: http://%s:%d", flags.Address, flags.Port)

go func() {
err = r.Run(fmt.Sprintf("%s:%d", flags.Address, flags.BetaPort))
err = r.Run(fmt.Sprintf("%s:%d", flags.Address, flags.Port))
if err != nil {
log.Fatalf("Error starting server: %s", err)
}
}()

go func() {
log.Println("Starting Odigos Dep UI...")
log.Printf("Odigos UI is available at: http://%s:%d", flags.Address, flags.Port)
err = d.Run(fmt.Sprintf("%s:%d", flags.Address, flags.Port))
log.Printf("Odigos Legacy UI is available at: http://%s:%d", flags.Address, flags.LegacyPort)
err = d.Run(fmt.Sprintf("%s:%d", flags.Address, flags.LegacyPort))
if err != nil {
log.Fatalf("Error starting server: %s", err)
}
Expand Down

0 comments on commit b737013

Please sign in to comment.