Save server EntryRoot and OS type during init, use to progress toward Windows server support

This commit is contained in:
2024-05-30 22:57:05 -04:00
parent 29d7f4d655
commit 7dd313add0
2 changed files with 7 additions and 1 deletions
+3
View File
@@ -6,6 +6,7 @@ import (
"github.com/rwinkhart/MUTN/src/cli" "github.com/rwinkhart/MUTN/src/cli"
"github.com/rwinkhart/MUTN/src/sync" "github.com/rwinkhart/MUTN/src/sync"
"os" "os"
"strconv"
"strings" "strings"
) )
@@ -30,6 +31,8 @@ func main() {
case "register": case "register":
// register a new device ID // register a new device ID
os.Create(backend.ConfigDir + backend.PathSeparator + "devices" + backend.PathSeparator + args[2]) os.Create(backend.ConfigDir + backend.PathSeparator + "devices" + backend.PathSeparator + args[2])
// print EntryRoot and bool indicating OS type to stdout for client to store in config
fmt.Print(backend.EntryRoot + "\x1d" + strconv.FormatBool(backend.IsWindows))
case "init": case "init":
// create the necessary directories for libmuttonserver to function // create the necessary directories for libmuttonserver to function
backend.DirInit() backend.DirInit()
+4 -1
View File
@@ -43,7 +43,10 @@ func TempInitCli() {
backend.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID, "sshUser": sshUser, "sshIP": sshIP, "sshPort": sshPort, "sshKey": sshKey, "sshKeyProtected": strconv.FormatBool(sshKeyProtected)}) backend.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID, "sshUser": sshUser, "sshIP": sshIP, "sshPort": sshPort, "sshKey": sshKey, "sshKeyProtected": strconv.FormatBool(sshKeyProtected)})
// generate device ID // generate device ID
sync.DeviceIDGen() sshEntryRoot, sshIsWindows := sync.DeviceIDGen()
// update config file with sshEntryRoot and sshIsWindows TODO append to existing config file
backend.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID, "sshUser": sshUser, "sshIP": sshIP, "sshPort": sshPort, "sshKey": sshKey, "sshKeyProtected": strconv.FormatBool(sshKeyProtected), "sshEntryRoot": sshEntryRoot, "sshIsWindows": sshIsWindows})
} else { } else {
// write config file // write config file
backend.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID}) backend.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID})