mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 20:52:33 +02:00
change default agent name to hostname
This commit is contained in:
parent
58ea9750d7
commit
9120bbea34
2 changed files with 16 additions and 4 deletions
|
@ -5,8 +5,8 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
network_mode: host # do not change this
|
network_mode: host # do not change this
|
||||||
environment:
|
environment:
|
||||||
GODOXY_AGENT_NAME: "agent-1"
|
GODOXY_AGENT_NAME: # defaults to hostname
|
||||||
GODOXY_AGENT_PORT: "8890"
|
GODOXY_AGENT_PORT: # defaults to 8890
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- ./certs:/app/certs # store Agent CA cert and Agent SSL cert
|
- ./certs:/app/certs # store Agent CA cert and Agent SSL cert
|
||||||
|
|
16
agent/pkg/env/env.go
vendored
16
agent/pkg/env/env.go
vendored
|
@ -1,8 +1,20 @@
|
||||||
package env
|
package env
|
||||||
|
|
||||||
import "github.com/yusing/go-proxy/internal/common"
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/yusing/go-proxy/internal/common"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DefaultAgentName() string {
|
||||||
|
name, err := os.Hostname()
|
||||||
|
if err != nil {
|
||||||
|
return "agent"
|
||||||
|
}
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
AgentName = common.GetEnvString("AGENT_NAME", "agent")
|
AgentName = common.GetEnvString("AGENT_NAME", DefaultAgentName())
|
||||||
AgentPort = common.GetEnvInt("AGENT_PORT", 8890)
|
AgentPort = common.GetEnvInt("AGENT_PORT", 8890)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue