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 { func NewAgentConfig() *rmm.AgentConfig {
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS) 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 { if err != nil {
return &rmm.AgentConfig{} 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 // skip on first call of inno setup if this is a new install
_, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS) _, 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 { if err != nil {
return nil return nil
} }

View File

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

View File

@ -24,6 +24,10 @@ import (
func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, meshdir string) { func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, meshdir string) {
k, _, err := registry.CreateKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS) 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 { if err != nil {
log.Fatalln("Error creating registry key:", err) log.Fatalln("Error creating registry key:", err)