Skip to content

Commit

Permalink
cmd: server should use default addr if none is specified (#420)
Browse files Browse the repository at this point in the history
With this commit, the server uses the default addr `0.0.0.0:7373`
if none is specified on the command line nor within the config
file.

Signed-off-by: Andreas Auernhammer <github@aead.dev>
  • Loading branch information
aead committed Nov 9, 2023
1 parent acc2ce4 commit 53b74e3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/kes/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,23 @@ func startServer(addrFlag, configFlag string) error {
return err
}

// Read the config file before looking up the
// local network interfaces. We may not know the
// server addr yet since a user may not specified
// one on the command line.
rawConfig, err := kesconf.ReadFile(configFlag)
if err != nil {
return err
}
if addrFlag == "" {
switch {
case addrFlag != "":
// Nothing to do, addrFlag is set
case rawConfig.Addr != "":
addrFlag = rawConfig.Addr
default:
addrFlag = "0.0.0.0:7373"
}

host, port, err := net.SplitHostPort(addrFlag)
if err != nil {
return err
Expand Down

0 comments on commit 53b74e3

Please sign in to comment.