From c36d0b38dd54eb6644d401f60f315f432466943c Mon Sep 17 00:00:00 2001 From: Moses Narrow <36607567+0pcom@users.noreply.github.com> Date: Fri, 7 Jul 2023 07:08:37 -0500 Subject: [PATCH] `source` a .conf file with `skywire-cli config gen` (#1558) * add explicit dmsgpty whitelist * add WIP env detection to skywire-cli config gen * stashing changes * add whitelist for survey collecton over dmsghttp * small fixes and formatting optimizations * make format * add nolint * remove unused variable, use print-style function instead of printf-style * update config gen with more flags ; support survey whitelist, route & tp setup node configuration * update vendor * update vendor * update vendor dependencies and go.mod * add error checks, comments * update vendor * fix vendor deps & update go.mod * make format & fix test error * remove viper from config gen * make format * prepare to revert some changes * prepare to revert some changes * fix panic on visor startup * fix ci errors * fix ci errors * fix golangci-lint errors for version 1.52.1 * update golangci-lint version used by github-actions CI in test workflow to 1.52.1 * fix CI darwin error * update excluded * make format check * update go.mod & go.sum * make format check ; merge develop * remove unneeded file * change vars to consts * remove comment * use http.Get * require 1 argument for config check-pk --- cmd/skywire-cli/commands/config/gen.go | 434 ++++++++++++++++++++++-- cmd/skywire-cli/commands/config/root.go | 4 + 2 files changed, 403 insertions(+), 35 deletions(-) diff --git a/cmd/skywire-cli/commands/config/gen.go b/cmd/skywire-cli/commands/config/gen.go index e5c3db600..dafe4a843 100644 --- a/cmd/skywire-cli/commands/config/gen.go +++ b/cmd/skywire-cli/commands/config/gen.go @@ -5,10 +5,12 @@ import ( "encoding/json" "fmt" "io" + "net" "net/http" "os" "os/exec" "path/filepath" + "strconv" "strings" "time" @@ -35,6 +37,7 @@ import ( var checkPKCmd = &cobra.Command{ Use: "check-pk ", Short: "check a skywire public key", + Args: cobra.ExactArgs(1), // Require exactly one argument Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { return @@ -59,19 +62,26 @@ var genKeysCmd = &cobra.Command{ }, } +var ( + isEnvs bool + skyenvfile = os.Getenv("SKYENV") +) +var envfile string + func init() { + var msg string //disable sorting, flags appear in the order shown here genConfigCmd.Flags().SortFlags = false RootCmd.AddCommand(genConfigCmd, genKeysCmd, checkPKCmd) - genConfigCmd.Flags().StringVarP(&serviceConfURL, "url", "a", utilenv.ServiceConfAddr, "services conf url\n\r") + genConfigCmd.Flags().StringVarP(&serviceConfURL, "url", "a", scriptExecArray(fmt.Sprintf("${SVCCONFADDR[@]-%s}", utilenv.ServiceConfAddr)), "services conf url\n\r") gHiddenFlags = append(gHiddenFlags, "url") - genConfigCmd.Flags().StringVar(&logLevel, "loglvl", "info", "[ debug | warn | error | fatal | panic | trace | info ]\033[0m") + genConfigCmd.Flags().StringVar(&logLevel, "loglvl", scriptExecString("${LOGLVL:-info}"), "level of logging in config\033[0m") gHiddenFlags = append(gHiddenFlags, "loglvl") - genConfigCmd.Flags().BoolVarP(&isBestProtocol, "bestproto", "b", false, "best protocol (dmsg | direct) based on location\033[0m") //this will also disable public autoconnect based on location + genConfigCmd.Flags().BoolVarP(&isBestProtocol, "bestproto", "b", scriptExecBool("${BESTPROTO:-false}"), "best protocol (dmsg | direct) based on location\033[0m") //this will also disable public autoconnect based on location genConfigCmd.Flags().BoolVarP(&isDisableAuth, "noauth", "c", false, "disable authentication for hypervisor UI\033[0m") gHiddenFlags = append(gHiddenFlags, "noauth") - genConfigCmd.Flags().BoolVarP(&isDmsgHTTP, "dmsghttp", "d", false, "use dmsg connection to skywire services\033[0m") + genConfigCmd.Flags().BoolVarP(&isDmsgHTTP, "dmsghttp", "d", scriptExecBool("${DMSGHTTP:-false}"), "use dmsg connection to skywire services\033[0m") gHiddenFlags = append(gHiddenFlags, "dmsghttp") genConfigCmd.Flags().BoolVarP(&isEnableAuth, "auth", "e", false, "enable auth on hypervisor UI\033[0m") gHiddenFlags = append(gHiddenFlags, "auth") @@ -79,24 +89,50 @@ func init() { gHiddenFlags = append(gHiddenFlags, "force") genConfigCmd.Flags().StringVarP(&disableApps, "disableapps", "g", "", "comma separated list of apps to disable\033[0m") gHiddenFlags = append(gHiddenFlags, "disableapps") - genConfigCmd.Flags().BoolVarP(&isHypervisor, "ishv", "i", false, "local hypervisor configuration\033[0m") - genConfigCmd.Flags().StringVarP(&hypervisorPKs, "hvpks", "j", "", "list of public keys to add as hypervisor\033[0m") - genConfigCmd.Flags().StringVar(&dmsgptyWlPKs, "dmsgpty", "", "add dmsgpty whitelist PKs") - genConfigCmd.Flags().StringVar(&surveyWhitelistPKs, "survey", "", "add survey whitelist PKs") + genConfigCmd.Flags().BoolVarP(&isHypervisor, "ishv", "i", scriptExecBool("${ISHYPERVISOR:-false}"), "local hypervisor configuration\033[0m") + msg = "list of public keys to add as hypervisor" + if scriptExecArray("${HYPERVISORPKS[@]}") != "" { + msg += "\n\r" + } + genConfigCmd.Flags().StringVarP(&hypervisorPKs, "hvpks", "j", scriptExecArray("${HYPERVISORPKS[@]}"), msg) + msg = "add dmsgpty whitelist PKs" + if scriptExecArray("${DMSGPTYPKS[@]}") != "" { + msg += "\n\r" + } + genConfigCmd.Flags().StringVar(&dmsgptyWlPKs, "dmsgpty", scriptExecArray("${DMSGPTYPKS[@]}"), msg) + msg = "add survey whitelist PKs" + if scriptExecArray("${SURVEYPKS[@]}") != "" { + msg += "\n\r" + } + + genConfigCmd.Flags().StringVar(&surveyWhitelistPKs, "survey", scriptExecArray("${SURVEYPKS[@]}"), msg) gHiddenFlags = append(gHiddenFlags, "survey") - genConfigCmd.Flags().StringVar(&routeSetupNodes, "routesetup", "", "add route setup node PKs") + msg = "add route setup node PKs" + if scriptExecArray("${ROUTESETUPPKS[@]}") != "" { + msg += "\n\r" + } + genConfigCmd.Flags().StringVar(&routeSetupNodes, "routesetup", scriptExecArray("${ROUTESETUPPKS[@]}"), msg) gHiddenFlags = append(gHiddenFlags, "routesetup") - genConfigCmd.Flags().StringVar(&transportSetupPKs, "tpsetup", "", "add transport setup PKs") + msg = "add transport setup node PKs" + if scriptExecArray("${ROUTESETUPPKS[@]}") != "" { + msg += "\n\r" + } + genConfigCmd.Flags().StringVar(&transportSetupPKs, "tpsetup", scriptExecArray("${ROUTESETUPPKS[@]}"), msg) gHiddenFlags = append(gHiddenFlags, "tpsetup") + genConfigCmd.Flags().StringVarP(&selectedOS, "os", "k", visorconfig.OS, "(linux / mac / win) paths\033[0m") gHiddenFlags = append(gHiddenFlags, "os") - genConfigCmd.Flags().BoolVarP(&isDisplayNodeIP, "publicip", "l", false, "allow display node ip in services\033[0m") + genConfigCmd.Flags().BoolVarP(&isDisplayNodeIP, "publicip", "l", scriptExecBool("${DISPLAYNODEIP:-false}"), "allow display node ip in services\033[0m") gHiddenFlags = append(gHiddenFlags, "publicip") genConfigCmd.Flags().BoolVarP(&addExampleApps, "example-apps", "m", false, "add example apps to the config\033[0m") gHiddenFlags = append(gHiddenFlags, "example-apps") genConfigCmd.Flags().BoolVarP(&isStdout, "stdout", "n", false, "write config to stdout\033[0m") gHiddenFlags = append(gHiddenFlags, "stdout") - genConfigCmd.Flags().StringVarP(&output, "out", "o", "", "output config\033[0m") + msg = "output config" + if scriptExecString("${OUTPUT}") == "" { + msg += ": " + visorconfig.ConfigName + } + genConfigCmd.Flags().StringVarP(&output, "out", "o", scriptExecString("${OUTPUT}"), msg+"\033[0m") if visorconfig.OS == "win" { pText = "use .msi installation path: " } @@ -106,41 +142,56 @@ func init() { if visorconfig.OS == "mac" { pText = "use mac installation path: " } - genConfigCmd.Flags().BoolVarP(&isPkgEnv, "pkg", "p", false, pText+visorconfig.SkywirePath+"\033[0m") + genConfigCmd.Flags().BoolVarP(&isPkgEnv, "pkg", "p", scriptExecBool("${PKGENV:-false}"), pText+visorconfig.SkywirePath+"\033[0m") homepath := visorconfig.HomePath() if homepath != "" { - genConfigCmd.Flags().BoolVarP(&isUsrEnv, "user", "u", false, "use paths for user space: "+homepath+"\033[0m") - genConfigCmd.MarkFlagsMutuallyExclusive("pkg", "user") - } + genConfigCmd.Flags().BoolVarP(&isUsrEnv, "user", "u", scriptExecBool("${USRENV:-false}"), "use paths for user space: "+homepath+"\033[0m") + } genConfigCmd.Flags().BoolVarP(&isRegen, "regen", "r", false, "re-generate existing config & retain keys") - genConfigCmd.MarkFlagsMutuallyExclusive("regen", "force") + if scriptExecString("${SK:-0000000000000000000000000000000000000000000000000000000000000000}") != "0000000000000000000000000000000000000000000000000000000000000000" { + sk.Set(scriptExecString("${SK:-0000000000000000000000000000000000000000000000000000000000000000}")) //nolint + } genConfigCmd.Flags().VarP(&sk, "sk", "s", "a random key is generated if unspecified\n\r") gHiddenFlags = append(gHiddenFlags, "sk") - genConfigCmd.Flags().BoolVarP(&isTestEnv, "testenv", "t", false, "use test deployment "+testConf+"\033[0m") + genConfigCmd.Flags().BoolVarP(&isTestEnv, "testenv", "t", scriptExecBool("${TESTENV:-false}"), "use test deployment "+testConf+"\033[0m") gHiddenFlags = append(gHiddenFlags, "testenv") - genConfigCmd.Flags().BoolVarP(&isVpnServerEnable, "servevpn", "v", false, "enable vpn server\033[0m") + genConfigCmd.Flags().BoolVarP(&isVpnServerEnable, "servevpn", "v", scriptExecBool("${SERVEVPN:-false}"), "enable vpn server\033[0m") gHiddenFlags = append(gHiddenFlags, "servevpn") genConfigCmd.Flags().BoolVarP(&isHide, "hide", "w", false, "dont print the config to the terminal :: show errors with -n flag\033[0m") gHiddenFlags = append(gHiddenFlags, "hide") genConfigCmd.Flags().BoolVarP(&isRetainHypervisors, "retainhv", "x", false, "retain existing hypervisors with regen\033[0m") gHiddenFlags = append(gHiddenFlags, "retainhv") - genConfigCmd.Flags().BoolVarP(&disablePublicAutoConn, "autoconn", "y", false, "disable autoconnect to public visors\033[0m") + genConfigCmd.Flags().BoolVarP(&disablePublicAutoConn, "autoconn", "y", scriptExecBool("${DISABLEPUBLICAUTOCONN:-false}"), "disable autoconnect to public visors\033[0m") gHiddenFlags = append(gHiddenFlags, "hide") - genConfigCmd.Flags().BoolVarP(&isPublic, "public", "z", false, "publicize visor in service discovery\033[0m") + genConfigCmd.Flags().BoolVarP(&isPublic, "public", "z", scriptExecBool("${VISORISPUBLIC:-false}"), "publicize visor in service discovery\033[0m") gHiddenFlags = append(gHiddenFlags, "public") - genConfigCmd.Flags().IntVar(&stcprPort, "stcpr", 0, "set tcp transport listening port - 0 for random\033[0m") + genConfigCmd.Flags().IntVar(&stcprPort, "stcpr", scriptExecInt("${STCPRPORT:-0}"), "set tcp transport listening port - 0 for random\033[0m") gHiddenFlags = append(gHiddenFlags, "stcpr") - genConfigCmd.Flags().IntVar(&sudphPort, "sudph", 0, "set udp transport listening port - 0 for random\033[0m") + genConfigCmd.Flags().IntVar(&sudphPort, "sudph", scriptExecInt("${SUDPHPORT:-0}"), "set udp transport listening port - 0 for random\033[0m") gHiddenFlags = append(gHiddenFlags, "sudph") genConfigCmd.Flags().BoolVar(&isAll, "all", false, "show all flags") - genConfigCmd.Flags().StringVar(&binPath, "binpath", "", "set bin_path\033[0m") + genConfigCmd.Flags().StringVar(&binPath, "binpath", scriptExecString("${BINPATH}"), "set bin_path\033[0m") gHiddenFlags = append(gHiddenFlags, "binpath") + // genConfigCmd.Flags().StringVar(&addSkysocksClientSrv, "proxyclientpk", scriptExecString("${PROXYCLIENTPK}"), "set server public key for proxy client") + // genConfigCmd.Flags().BoolVar(&proxyClientAutostart, "startproxyclient", scriptExecBool("${STARTPROXYCLIENT:-false}"), "autostart proxy client") + // genConfigCmd.Flags().BoolVar(&disableProxyServerAutostart, "noproxyserver", scriptExecBool("${NOPROXYSERVER:-false}"), "disable autostart of proxy server") + // genConfigCmd.Flags().StringVar(&proxyServerPass, "proxyserverpass", "", "set password for the proxy server") + // genConfigCmd.Flags().StringVar(&proxyClientPass, "proxyclientpass", "", "set password for the proxy client to access the proxy server (if needed)") + // // TODO: Password for accessing proxy client + // genConfigCmd.Flags().StringVar(&setVPNClientKillswitch, "killsw", "", "vpn client killswitch") + // genConfigCmd.Flags().StringVar(&addVPNClientSrv, "addvpn", "", "set vpn server public key for vpn client") + // genConfigCmd.Flags().StringVar(&addVPNClientPasscode, "vpnpass", "", "password for vpn client to access the vpn server (if needed)") + // genConfigCmd.Flags().StringVar(&addVPNServerPasscode, "vpnserverpass", "", "set password to the vpn server") + // genConfigCmd.Flags().StringVar(&setVPNServerSecure, "secure", "", "change secure mode status of vpn server") + // genConfigCmd.Flags().StringVar(&setVPNServerNetIfc, "netifc", "", "VPN Server network interface (detected: "+getInterfaceNames()+")") + genConfigCmd.Flags().BoolVarP(&isEnvs, "envs", "q", false, "show the environmental variable settings") + gHiddenFlags = append(gHiddenFlags, "envs") genConfigCmd.Flags().BoolVar(&noFetch, "nofetch", false, "do not fetch the services from the service conf url") gHiddenFlags = append(gHiddenFlags, "nofetch") genConfigCmd.Flags().BoolVar(&noDefaults, "nodefaults", false, "do not use hardcoded defaults for production / test services") gHiddenFlags = append(gHiddenFlags, "nodefaults") - genConfigCmd.Flags().StringVar(&ver, "version", "", "custom version testing override\033[0m") + genConfigCmd.Flags().StringVar(&ver, "version", scriptExecString("${VERSION}"), "custom version testing override\033[0m") gHiddenFlags = append(gHiddenFlags, "version") //show all flags on help @@ -151,11 +202,158 @@ func init() { } } +func scriptExecString(s string) string { + if visorconfig.OS == "windows" { + var variable, defaultvalue string + if strings.Contains(s, ":-") { + parts := strings.SplitN(s, ":-", 2) + variable = parts[0] + "}" + defaultvalue = strings.TrimRight(parts[1], "}") + } else { + variable = s + defaultvalue = "" + } + out, err := script.Exec(fmt.Sprintf(`powershell -c '$SKYENV = "%s"; if ($SKYENV -ne "" -and (Test-Path $SKYENV)) { . $SKYENV }; echo %s"`, skyenvfile, variable)).String() + if err == nil { + if (out == "") || (out == variable) { + return defaultvalue + } + return strings.TrimRight(out, "\n") + } + return defaultvalue + } + z, err := script.Exec(fmt.Sprintf(`bash -c 'SKYENV=%s ; if [[ $SKYENV != "" ]] && [[ -f $SKYENV ]] ; then source $SKYENV ; fi ; printf "%s"'`, skyenvfile, s)).String() + if err == nil { + return strings.TrimSpace(z) + } + return "" +} + +func scriptExecBool(s string) bool { + if visorconfig.OS == "windows" { + var variable string + if strings.Contains(s, ":-") { + parts := strings.SplitN(s, ":-", 2) + variable = parts[0] + "}" + } else { + variable = s + } + out, err := script.Exec(fmt.Sprintf(`powershell -c '$SKYENV = "%s"; if ($SKYENV -ne "" -and (Test-Path $SKYENV)) { . $SKYENV }; echo %s"`, skyenvfile, variable)).String() + if err == nil { + if (out == "") || (out == variable) { + return false + } + b, err := strconv.ParseBool(strings.TrimSpace(strings.TrimRight(out, "\n"))) + if err == nil { + return b + } + } + return false + } + z, err := script.Exec(fmt.Sprintf(`bash -c 'SKYENV=%s ; if [[ $SKYENV != "" ]] && [[ -f $SKYENV ]] ; then source $SKYENV ; fi ; printf "%s"'`, skyenvfile, s)).String() + if err == nil { + b, err := strconv.ParseBool(z) + if err == nil { + return b + } + } + + return false +} + +func scriptExecArray(s string) string { + if visorconfig.OS == "windows" { + variable := s + if strings.Contains(variable, "[@]}") { + variable = strings.TrimRight(variable, "[@]}") + variable = strings.TrimRight(variable, "{") + } + out, err := script.Exec(fmt.Sprintf(`powershell -c '$SKYENV = "%s"; if ($SKYENV -ne "" -and (Test-Path $SKYENV)) { . $SKYENV }; foreach ($item in %s) { Write-Host $item }'`, skyenvfile, variable)).Slice() + if err == nil { + if len(out) != 0 { + return "" + } + return strings.Join(out, ",") + } + } + y, err := script.Exec(fmt.Sprintf(`bash -c 'SKYENV=%s ; if [[ $SKYENV != "" ]] && [[ -f $SKYENV ]] ; then source $SKYENV ; fi ; for _i in %s ; do echo "$_i" ; done'`, skyenvfile, s)).Slice() + if err == nil { + return strings.Join(y, ",") + } + return "" +} + +func scriptExecInt(s string) int { + if visorconfig.OS == "windows" { + var variable string + if strings.Contains(s, ":-") { + parts := strings.SplitN(s, ":-", 2) + variable = parts[0] + "}" + } else { + variable = s + } + out, err := script.Exec(fmt.Sprintf(`powershell -c '$SKYENV = "%s"; if ($SKYENV -ne "" -and (Test-Path $SKYENV)) { . $SKYENV }; echo %s"`, skyenvfile, variable)).String() + if err == nil { + if (out == "") || (out == variable) { + return 0 + } + i, err := strconv.Atoi(strings.TrimSpace(strings.TrimRight(out, "\n"))) + if err == nil { + return i + } + return 0 + } + return 0 + } + z, err := script.Exec(fmt.Sprintf(`bash -c 'SKYENV=%s ; if [[ $SKYENV != "" ]] && [[ -f $SKYENV ]] ; then source $SKYENV ; fi ; printf "%s"'`, skyenvfile, s)).String() + if err == nil { + if z == "" { + return 0 + } + i, err := strconv.Atoi(z) + if err == nil { + return i + } + } + return 0 +} + var genConfigCmd = &cobra.Command{ Use: "gen", Short: "Generate a config file", + Long: func() string { + if visorconfig.OS == "linux" { + if skyenvfile == "" { + return `Generate a config file + + Config defaults file may also be specified with + SKYENV=/path/to/skywire.conf skywire-cli config gen` + } + if _, err := os.Stat(skyenvfile); err == nil { + return `Generate a config file + + skyenv file detected: ` + skyenvfile + } + return `Generate a config file + + Config defaults file may also be specified with + SKYENV=/path/to/skywire.conf skywire-cli config gen` + } + return `Generate a config file` + + }(), PreRun: func(cmd *cobra.Command, _ []string) { log := logger + if isEnvs { + if visorconfig.OS == "windows" { + envfile = envfileWindows + } else { + envfile = envfileLinux + } + fmt.Println(envfile) + os.Exit(0) + } + //--all unhides flags, prints help menu, and exits if isAll { for _, j := range gHiddenFlags { @@ -182,6 +380,14 @@ var genConfigCmd = &cobra.Command{ if isStdout { isRegen = false } + //--force will delete a config, which excludes --regen + if (isForce) && (isRegen) { + log.Fatal("Use of mutually exclusive flags: -f --force cannot override -r --regen") + } + // these flags overwrite each other + if (isUsrEnv) && (isPkgEnv) { + log.Fatal("Use of mutually exclusive flags: -u --user and -p --pkg") + } //enable local hypervisor by default for user if isUsrEnv { isHypervisor = true @@ -281,16 +487,10 @@ var genConfigCmd = &cobra.Command{ } // create an http client to fetch the services client := http.Client{ - Timeout: time.Second * 15, // Timeout after 30 seconds - } - //create the http request - req, err := http.NewRequest(http.MethodGet, fmt.Sprint(serviceConfURL), nil) - if err != nil { - log.WithError(err).Fatal("Failed to create http request\n") + Timeout: time.Second * 15, // Timeout after 15 seconds } - req.Header.Add("Cache-Control", "no-cache") - //check for errors in the response - res, err := client.Do(req) + // Make the HTTP GET request + res, err := client.Get(fmt.Sprint(serviceConfURL)) if err != nil { //silence errors for stdout if !isStdout { @@ -298,7 +498,7 @@ var genConfigCmd = &cobra.Command{ log.Warn("Falling back on hardcoded servers") } } else { - // nil error from client.Do(req) + // nil error from client.Get if res.Body != nil { defer res.Body.Close() //nolint } @@ -855,3 +1055,167 @@ var genConfigCmd = &cobra.Command{ log.Infof("Updated file '%s' to:\n%s\n", output, j) }, } + +func getInterfaceNames() string { //nolint Note: pending implementation for config gen + interfaces, err := net.Interfaces() + if err != nil { + fmt.Println("Error:", err) + return "" + } + + var interfaceNames []string + defaultInterface := "" + for _, iface := range interfaces { + if iface.Flags&net.FlagLoopback == 0 { + interfaceNames = append(interfaceNames, iface.Name) + if iface.Index == 0 && defaultInterface == "" { + defaultInterface = iface.Name + } + } + } + + if defaultInterface != "" { + // Move the default interface name to the beginning of the list + for i, name := range interfaceNames { + if name == defaultInterface { + copy(interfaceNames[1:i+1], interfaceNames[:i]) + interfaceNames[0] = defaultInterface + break + } + } + } + + return strings.Join(interfaceNames, ", ") +} + +const envfileLinux = `# +# /etc/skywire.conf +# +######################################################################### +# SKYWIRE CONFIG TEMPLATE +# Defaults for booleans are false +# Uncomment to change default value +######################################################################### + +#-- Other Visors will automatically establish transports to this visor +# requires port forwarding or public ip +#VISORISPUBLIC=true + +#-- Autostart vpn server for this visor +#VPNSERVER=true + +#-- Use test deployment +#TESTENV=true + +#-- Automatically determine the best protocol (dmsg or http) +# based on location to connect to the deployment servers +#BESTPROTO=true + +#-- Set custom service conf URLs +#SVCCONFADDR=('') + +#-- Set visor runtime log level. +# Default is info ; uncomment for debug logging +#LOGLVL=debug + +#-- Use dmsghttp to connect to the production deployment +#DMSGHTTP=true + +#-- Start the hypervisor interface for this visor +#ISHYPERVISOR=true + +#-- Output path of the config file +#OUTPUT='./skywire-config.json' + +#-- Display the node ip in the service discovery +# for any public services this visor is running +#DISPLAYNODEIP=true + +#-- Set remote hypervisor public keys +#HYPERVISORPKS=('') + +#-- Default config paths for the installer or package (system paths) +#PKGENV=true + +#-- Default config paths for the current userspace +#USRENV=true + +#-- Set secret key +#SK='' + +#-- Disable auto-transports to public visors +#DISABLEPUBLICAUTOCONN=true + +#-- Custom config version override +#VERSION='' + +#-- Set app bin_path +#BINPATH='./apps' + +` +const envfileWindows = `# +# C:\ProgramData\skywire.ps1 +# +######################################################################### +# SKYWIRE CONFIG TEMPLATE +# Defaults for booleans are false +# Uncomment to change default value +######################################################################### + +#-- Other Visors will automatically establish transports to this visor +# requires port forwarding or public ip +#$VISORISPUBLIC=true + +#-- Autostart vpn server for this visor +#$VPNSERVER=true + +#-- Use test deployment +#$TESTENV=true + +#-- Automatically determine the best protocol (dmsg or http) +# based on location to connect to the deployment servers +#$BESTPROTO=true + +#-- Set custom service conf URLs +#$SVCCONFADDR= @('') + +#-- Set visor runtime log level. +# Default is info ; uncomment for debug logging +#$LOGLVL=debug + +#-- Use dmsghttp to connect to the production deployment +#$DMSGHTTP=true + +#-- Start the hypervisor interface for this visor +#$ISHYPERVISOR=true + +#-- Output path of the config file +#$OUTPUT='./skywire-config.json' + +#-- Display the node ip in the service discovery +# for any public services this visor is running +#$DISPLAYNODEIP=true + +#-- Set remote hypervisor public keys +#$HYPERVISORPKS= @('') +#$HYPERVISORPKS= @('','') + +#-- Default config paths for the installer or package (system paths) +#$PKGENV=true + +#-- Default config paths for the current userspace +#$USRENV=true + +#-- Set secret key +#$SK='' + +#-- Disable auto-transports to public visors +#$DISABLEPUBLICAUTOCONN=true + +#-- Custom config version override +#$VERSION='' + +#-- Set app bin_path +#$BINPATH='./apps' + +` diff --git a/cmd/skywire-cli/commands/config/root.go b/cmd/skywire-cli/commands/config/root.go index 0a1eb7fa8..abbb30b3b 100644 --- a/cmd/skywire-cli/commands/config/root.go +++ b/cmd/skywire-cli/commands/config/root.go @@ -15,6 +15,10 @@ import ( var logger = logging.MustGetLogger("skywire-cli") +// proxyClientAutostart bool //nolint Note: pending implementation for config gen +// disableProxyServerAutostart bool //nolint Note: pending implementation for config gen +// proxyServerPass string //nolint Note: pending implementation for config gen +// proxyClientPass string //nolint Note: pending implementation for config gen var ( conf = new(visorconfig.V1) dmsgHTTPServersList = &visorconfig.DmsgHTTPServers{