Add Settings window to Agent UI

Agent systray UI has been extended with
a setting window that allows configuring 
management URL, admin URL and 
supports pre-shared key.
While for the Netbird managed version 
the Settings are not necessary, it helps
to properly configure the self-hosted version.
This commit is contained in:
Givi Khojanashvili
2022-04-15 19:30:12 +04:00
committed by GitHub
parent 196207402d
commit 951e011a9c
25 changed files with 767 additions and 244 deletions

View File

@@ -3,6 +3,7 @@ package cmd
import (
"context"
"fmt"
"github.com/netbirdio/netbird/util"
log "github.com/sirupsen/logrus"
@@ -28,7 +29,7 @@ var loginCmd = &cobra.Command{
// workaround to run without service
if logFile == "console" {
config, err := internal.GetConfig(managementURL, configPath, preSharedKey)
config, err := internal.GetConfig(managementURL, adminURL, configPath, preSharedKey)
if err != nil {
log.Errorf("get config file: %v", err)
return err
@@ -56,7 +57,7 @@ var loginCmd = &cobra.Command{
request := proto.LoginRequest{
SetupKey: setupKey,
PresharedKey: preSharedKey,
PreSharedKey: preSharedKey,
ManagementUrl: managementURL,
}
client := proto.NewDaemonServiceClient(conn)

View File

@@ -28,6 +28,7 @@ var (
logFile string
daemonAddr string
managementURL string
adminURL string
setupKey string
preSharedKey string
rootCmd = &cobra.Command{
@@ -56,6 +57,7 @@ func init() {
}
rootCmd.PersistentFlags().StringVar(&daemonAddr, "daemon-addr", defaultDaemonAddr, "Daemon service address to serve CLI requests [unix|tcp]://[path|host:port]")
rootCmd.PersistentFlags().StringVar(&managementURL, "management-url", "", fmt.Sprintf("Management Service URL [http|https]://[host]:[port] (default \"%s\")", internal.ManagementURLDefault().String()))
rootCmd.PersistentFlags().StringVar(&adminURL, "admin-url", "https://app.netbird.io", "Admin Panel URL [http|https]://[host]:[port]")
rootCmd.PersistentFlags().StringVar(&configPath, "config", defaultConfigPath, "Wiretrustee config file location")
rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "info", "sets Wiretrustee log level")
rootCmd.PersistentFlags().StringVar(&logFile, "log-file", defaultLogFile, "sets Wiretrustee log path. If console is specified the the log will be output to stdout")

View File

@@ -54,7 +54,7 @@ func (p *program) Start(svc service.Service) error {
}
}
serverInstance := server.New(p.ctx, managementURL, configPath)
serverInstance := server.New(p.ctx, managementURL, adminURL, configPath, logFile)
if err := serverInstance.Start(); err != nil {
log.Fatalf("failed start daemon: %v", err)
}

View File

@@ -93,7 +93,7 @@ func startClientDaemon(
}
s := grpc.NewServer()
server := client.New(ctx, managementURL, configPath)
server := client.New(ctx, managementURL, adminURL, configPath, "")
if err := server.Start(); err != nil {
t.Fatal(err)
}

View File

@@ -27,7 +27,7 @@ var upCmd = &cobra.Command{
// workaround to run without service
if logFile == "console" {
config, err := internal.GetConfig(managementURL, configPath, preSharedKey)
config, err := internal.GetConfig(managementURL, adminURL, configPath, preSharedKey)
if err != nil {
log.Errorf("get config file: %v", err)
return err
@@ -57,7 +57,7 @@ var upCmd = &cobra.Command{
loginRequest := proto.LoginRequest{
SetupKey: setupKey,
PresharedKey: preSharedKey,
PreSharedKey: preSharedKey,
ManagementUrl: managementURL,
}
err = WithBackOff(func() error {