mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 03:46:02 +08:00
add network name from cli
This commit is contained in:
parent
449118c24d
commit
31da842b97
1 changed files with 17 additions and 2 deletions
|
@ -3,6 +3,7 @@ package command
|
||||||
import (
|
import (
|
||||||
"crypto/ed25519"
|
"crypto/ed25519"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gravitl/netmaker/logger"
|
"github.com/gravitl/netmaker/logger"
|
||||||
|
@ -145,10 +146,24 @@ func Install() error {
|
||||||
|
|
||||||
// Connect - re-instates a connection of a node
|
// Connect - re-instates a connection of a node
|
||||||
func Connect(cfg config.ClientConfig) error {
|
func Connect(cfg config.ClientConfig) error {
|
||||||
return nil
|
networkName := cfg.Network
|
||||||
|
if networkName == "" {
|
||||||
|
networkName = cfg.Node.Network
|
||||||
|
}
|
||||||
|
if networkName == "" {
|
||||||
|
return fmt.Errorf("no network specified")
|
||||||
|
}
|
||||||
|
return functions.Connect(networkName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disconnect - disconnects a connection of a node
|
// Disconnect - disconnects a connection of a node
|
||||||
func Disconnect(cfg config.ClientConfig) error {
|
func Disconnect(cfg config.ClientConfig) error {
|
||||||
return nil
|
networkName := cfg.Network
|
||||||
|
if networkName == "" {
|
||||||
|
networkName = cfg.Node.Network
|
||||||
|
}
|
||||||
|
if networkName == "" {
|
||||||
|
return fmt.Errorf("no network specified")
|
||||||
|
}
|
||||||
|
return functions.Disconnect(networkName)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue