Browse Source

Merge pull request #353 from SekoiaLab/feat/change-default-hostname

Feat/change default hostname
dcarns 3 years ago
parent
commit
da8ed89e55
1 changed files with 6 additions and 1 deletions
  1. 6 1
      netclient/main.go

+ 6 - 1
netclient/main.go

@@ -26,6 +26,11 @@ func main() {
 	app.Usage = "Netmaker's netclient agent and CLI. Used to perform interactions with Netmaker server and set local WireGuard config."
 	app.Version = "v0.8.3"
 
+	hostname, err := os.Hostname()
+	if err != nil {
+		hostname = ""
+	}
+
 	cliFlags := []cli.Flag{
 		&cli.StringFlag{
 			Name:    "network",
@@ -91,7 +96,7 @@ func main() {
 		&cli.StringFlag{
 			Name:    "name",
 			EnvVars: []string{"NETCLIENT_NAME"},
-			Value:   "",
+			Value:   hostname,
 			Usage:   "Identifiable name for machine within Netmaker network.",
 		},
 		&cli.StringFlag{