testing setup

This commit is contained in:
redanthrax 2022-06-15 18:26:10 -07:00
parent 7457bf0b93
commit 7c46970b67
7 changed files with 109 additions and 59 deletions

View file

@ -13,14 +13,12 @@ package agent
import (
"log"
"os"
"strings"
"github.com/spf13/viper"
)
const (
etcConfig = "/etc/tacticalagent"
)
func (a *Agent) checkExistingAndRemove(silent bool) {}
func (a *Agent) installerMsg(msg, alert string, silent bool) {
@ -42,7 +40,13 @@ func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, me
viper.Set("proxy", proxy)
viper.Set("meshdir", meshdir)
viper.SetConfigPermissions(0660)
err := viper.SafeWriteConfigAs(etcConfig)
configLocation := "/etc/tacticalagent"
if strings.HasSuffix(os.Args[0], ".test") {
configLocation = "tacticalagent"
}
err := viper.SafeWriteConfigAs(configLocation)
if err != nil {
log.Fatalln("createAgentConfig", err)
}