Skip to content

Commit

Permalink
Apply review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-antoniak committed Jul 2, 2024
1 parent 49b874c commit c359db6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export ZDM_TARGET_PASSWORD=cassandra \
./zdm-proxy-v2.0.0 # run the ZDM proxy executable
```

If you prefer to use YAML configuration file, analogical setup would look like:
If you prefer to use YAML configuration file, an equivalent setup would look like:

```shell
$ cat zdm-config.yml
Expand Down
2 changes: 1 addition & 1 deletion RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ All published container images can be found at [https://hub.docker.com/r/datasta

Before triggering the build and publish process for an official/stable release, three files need to be updated, the `RELEASE_NOTES`, `CHANGELOG` and `main.go`.

Please update the ZDM version displayed during component startup in `main.go`:
Please update the ZDM version displayed during component startup in `launch.go`:
```go
const ZdmVersionString = "2.0.0"
```
Expand Down
14 changes: 6 additions & 8 deletions proxy/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
// TODO: to be managed externally
const ZdmVersionString = "2.2.0"

var displayVersionOpt = flag.Bool("version", false, "display the ZDM proxy version and exit")
var configFileOpt = flag.String("config", "", "specify path to ZDM configuration file")
var displayVersion = flag.Bool("version", false, "display the ZDM proxy version and exit")
var configFile = flag.String("config", "", "specify path to ZDM configuration file")

func runSignalListener(cancelFunc context.CancelFunc) {
sigCh := make(chan os.Signal, 1)
Expand All @@ -31,18 +31,16 @@ func runSignalListener(cancelFunc context.CancelFunc) {
}()
}

func displayVersion() {
if *displayVersionOpt {
func launchProxy(profilingSupported bool) {
if *displayVersion {
fmt.Printf("ZDM proxy version %v\n", ZdmVersionString)
os.Exit(0)
return
}

// Always record version information (very) early in the log
log.Infof("Starting ZDM proxy version %v", ZdmVersionString)
}

func launchProxy(profilingSupported bool, configFile string) {
conf, err := config.New().LoadConfig(configFile)
conf, err := config.New().LoadConfig(*configFile)

if err != nil {
log.Errorf("Error loading configuration: %v. Aborting startup.", err)
Expand Down
5 changes: 1 addition & 4 deletions proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import (
)

func main() {

flag.Parse()

displayVersion()

launchProxy(false, *configFileOpt)
launchProxy(false)
}
5 changes: 1 addition & 4 deletions proxy/main_profiling.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ var cpuProfile = flag.String("cpu_profile", "", "write cpu profile to the specif
var memProfile = flag.String("mem_profile", "", "write memory profile to the specified file")

func main() {

flag.Parse()

displayVersion()

// the cpu profiling is enabled at startup and is periodically collected while the proxy is running
// if cpu profiling is requested, any error configuring or starting it will cause the proxy startup to fail
if *cpuProfile != "" {
Expand Down Expand Up @@ -63,5 +60,5 @@ func main() {
}()
}

launchProxy(true, configFileOpt)
launchProxy(true)
}

0 comments on commit c359db6

Please sign in to comment.