mirror of
https://github.com/project-zot/zot.git
synced 2026-06-19 14:08:01 +08:00
report listening port when chosen by kernel (#770)
Based off of the PR by @thesayyn https://github.com/project-zot/zot/pull/720 Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
committed by
GitHub
parent
d68bbf6743
commit
f3faae0e09
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -232,6 +233,10 @@ func validateStorageConfig(cfg *config.Config) error {
|
||||
}
|
||||
|
||||
func validateConfiguration(config *config.Config) error {
|
||||
if err := validateHTTP(config); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := validateGC(config); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -514,6 +519,21 @@ func validateLDAP(config *config.Config) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateHTTP(config *config.Config) error {
|
||||
if config.HTTP.Port != "" {
|
||||
port, err := strconv.ParseInt(config.HTTP.Port, 10, 64)
|
||||
if err != nil || (port < 0 || port > 65535) {
|
||||
log.Error().Str("port", config.HTTP.Port).Msg("invalid port")
|
||||
|
||||
return errors.ErrBadConfig
|
||||
}
|
||||
|
||||
fmt.Printf("HTTP port %d\n", port)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateGC(config *config.Config) error {
|
||||
// enforce GC params
|
||||
if config.Storage.GCDelay < 0 {
|
||||
|
||||
Reference in New Issue
Block a user