Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ type authConfig struct {
InsecureSkipVerify bool
}
type clairctlConfig struct {
IP, Interface, TempFolder string
Port int
IP, Interface, BindAddr, TempFolder string
Port int
}
type docker struct {
InsecureRegistries []string
Expand Down Expand Up @@ -119,6 +119,9 @@ func Init(cfgFile string, logLevel string, noClean bool) {
if viper.Get("clairctl.interface") == nil {
viper.Set("clairctl.interface", "")
}
if viper.Get("clairctl.bind_addr") == nil {
viper.Set("clairctl.bind_addr", "")
}
if viper.Get("clairctl.tempFolder") == nil {
viper.Set("clairctl.tempFolder", "/tmp/clairctl")
}
Expand Down Expand Up @@ -146,6 +149,7 @@ func values() config {
Clairctl: clairctlConfig{
IP: viper.GetString("clairctl.ip"),
Port: viper.GetInt("clairctl.port"),
BindAddr: viper.GetString("clairctl.bind_addr"),
TempFolder: viper.GetString("clairctl.tempFolder"),
Interface: viper.GetString("clairctl.interface"),
},
Expand Down
7 changes: 6 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ func Serve(sURL string) error {
}

func tcpListener(sURL string) (listener net.Listener) {
listener, err := net.Listen("tcp", sURL)
listenOn := sURL
if viper.GetString("clairctl.bind_addr") != "" {
listenOn = viper.GetString("clairctl.bind_addr") + ":" + viper.GetString("clairctl.port")
}
log.Debugf("Listinging on: %s", listenOn)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a typo here: "Listinging"

listener, err := net.Listen("tcp", listenOn)
if err != nil {
log.Fatalf("cannot instanciate listener: %v", err)
}
Expand Down