updates for testing in windows

This commit is contained in:
redanthrax 2022-06-15 20:12:48 -07:00
parent 30123bc023
commit 13b5474cd8
3 changed files with 15 additions and 3 deletions

View File

@ -48,6 +48,11 @@ var (
func NewAgentConfig() *rmm.AgentConfig {
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS)
if shared.TEST {
err = nil
k, _, err := registry.OpenKey(registry.CURRENT_USER, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS)
}
if err != nil {
return &rmm.AgentConfig{}
}
@ -835,6 +840,11 @@ func (a *Agent) InstallService() error {
// skip on first call of inno setup if this is a new install
_, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS)
if shared.TEST {
err = nil
k, _, err := registry.OpenKey(registry.CURRENT_USER, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS)
}
if err != nil {
return nil
}

View File

@ -13,9 +13,7 @@ package agent
import (
"log"
"os"
"strings"
"github.com/amidaware/rmmagent/shared"
"github.com/spf13/viper"
)

View File

@ -24,6 +24,10 @@ import (
func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, meshdir string) {
k, _, err := registry.CreateKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS)
if shared.TEST {
err = nil
k, _, err := registry.OpenKey(registry.CURRENT_USER, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS)
}
if err != nil {
log.Fatalln("Error creating registry key:", err)