Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 9dee875

Browse files
committed
chore: host check
1 parent a37b187 commit 9dee875

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

system/context.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package system
22

33
import (
4+
"fmt"
45
logger "github.com/sirupsen/logrus"
56
"net"
67
"os"
@@ -66,6 +67,9 @@ func (DebugLogger) Error(obj interface{}) {
6667
// projectDefinition = project definition object
6768
func InitializeContext(host string, action string, projectDefinition *project.Project) {
6869
Context.TargetHost = net.ParseIP(host)
70+
if Context.TargetHost == nil {
71+
panic(fmt.Errorf("invalid target host"))
72+
}
6973
Context.CurrentAction = action
7074
Context.Project = projectDefinition
7175
Context.IsCI = os.Getenv("CI") != ""

0 commit comments

Comments
 (0)