slight improvements to agent memory usage

This commit is contained in:
Henry Dollman
2024-08-18 17:45:39 -04:00
parent 683dc74cbf
commit b5607025f7
2 changed files with 113 additions and 75 deletions

View File

@@ -29,14 +29,14 @@ func main() {
log.Fatal("KEY environment variable is not set")
}
port := ":45876"
if p, exists := os.LookupEnv("PORT"); exists {
addr := ":45876"
if portEnvVar, exists := os.LookupEnv("PORT"); exists {
// allow passing an address in the form of "127.0.0.1:45876"
if !strings.Contains(p, ":") {
p = ":" + p
if !strings.Contains(portEnvVar, ":") {
portEnvVar = ":" + portEnvVar
}
port = p
addr = portEnvVar
}
agent.NewAgent(pubKey, port).Run()
agent.NewAgent(pubKey, addr).Run()
}