mirror of
https://github.com/restic/rest-server.git
synced 2025-12-06 17:15:45 -08:00
Merge pull request #271 from ae-govau/printlistenaddr
fix: print the actual address listened on
This commit is contained in:
10
changelog/unreleased/pull-271
Normal file
10
changelog/unreleased/pull-271
Normal file
@@ -0,0 +1,10 @@
|
||||
Enhancement: print actual listen address after start-up
|
||||
|
||||
When started with `--listen :0` the server would print `start server on :0`
|
||||
|
||||
Now the message includes the actual address listened on, for example
|
||||
`start server on 0.0.0.0:37333`.
|
||||
|
||||
This is useful when starting a server with an auto-allocated free port number (port 0).
|
||||
|
||||
https://github.com/restic/rest-server/pull/271
|
||||
@@ -28,7 +28,7 @@ func findListener(addr string) (listener net.Listener, err error) {
|
||||
return nil, fmt.Errorf("listen on %v failed: %w", addr, err)
|
||||
}
|
||||
|
||||
log.Printf("start server on %v", addr)
|
||||
log.Printf("start server on %v", listener.Addr())
|
||||
return listener, nil
|
||||
|
||||
case 1:
|
||||
|
||||
@@ -14,6 +14,6 @@ func findListener(addr string) (listener net.Listener, err error) {
|
||||
return nil, fmt.Errorf("listen on %v failed: %w", addr, err)
|
||||
}
|
||||
|
||||
log.Printf("start server on %v", addr)
|
||||
log.Printf("start server on %v", listener.Addr())
|
||||
return listener, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user