fix(agent): typo for /distribution endpoint and update related configurations

This commit is contained in:
yusing 2025-05-09 11:37:41 +08:00
parent 455a85e6a0
commit ead27c72f1
4 changed files with 37 additions and 37 deletions

View file

@ -9,7 +9,7 @@ services:
AGENT_PORT: "{{.Port}}"
AGENT_CA_CERT: "{{.CACert}}"
AGENT_SSL_CERT: "{{.SSLCert}}"
# docker socket proxy
# docker socket proxy: [host]:port
# unset DOCKER_SOCKET_ADDR to disable
DOCKER_SOCKET_ADDR: 127.0.0.1:2375
POST: false
@ -21,7 +21,7 @@ services:
COMMIT: false
CONFIGS: false
CONTAINERS: false
DISTRIBUTIONS: false
DISTRIBUTION: false
EVENTS: true
EXEC: false
GRPC: false

58
agent/pkg/env/env.go vendored
View file

@ -21,34 +21,34 @@ var (
AgentCACert string
AgentSSLCert string
DockerSocketAddr string
DockerPost bool
DockerRestarts bool
DockerStart bool
DockerStop bool
DockerAuth bool
DockerBuild bool
DockerCommit bool
DockerConfigs bool
DockerContainers bool
DockerDistributions bool
DockerEvents bool
DockerExec bool
DockerGrpc bool
DockerImages bool
DockerInfo bool
DockerNetworks bool
DockerNodes bool
DockerPing bool
DockerPlugins bool
DockerSecrets bool
DockerServices bool
DockerSession bool
DockerSwarm bool
DockerSystem bool
DockerTasks bool
DockerVersion bool
DockerVolumes bool
DockerSocketAddr string
DockerPost bool
DockerRestarts bool
DockerStart bool
DockerStop bool
DockerAuth bool
DockerBuild bool
DockerCommit bool
DockerConfigs bool
DockerContainers bool
DockerDistribution bool
DockerEvents bool
DockerExec bool
DockerGrpc bool
DockerImages bool
DockerInfo bool
DockerNetworks bool
DockerNodes bool
DockerPing bool
DockerPlugins bool
DockerSecrets bool
DockerServices bool
DockerSession bool
DockerSwarm bool
DockerSystem bool
DockerTasks bool
DockerVersion bool
DockerVolumes bool
)
func init() {
@ -75,7 +75,7 @@ func Load() {
DockerCommit = common.GetEnvBool("COMMIT", false)
DockerConfigs = common.GetEnvBool("CONFIGS", false)
DockerContainers = common.GetEnvBool("CONTAINERS", false)
DockerDistributions = common.GetEnvBool("DISTRIBUTIONS", false)
DockerDistribution = common.GetEnvBool("DISTRIBUTION", false)
DockerEvents = common.GetEnvBool("EVENTS", true)
DockerExec = common.GetEnvBool("EXEC", false)
DockerGrpc = common.GetEnvBool("GRPC", false)

View file

@ -236,8 +236,8 @@ func TestNewDockerHandler_PathHandling(t *testing.T) {
{"Configs path", "/configs", "DockerConfigs", true, http.MethodGet, true},
{"Configs path disabled", "/configs", "DockerConfigs", false, http.MethodGet, false},
{"Distributions path", "/distributions", "DockerDistributions", true, http.MethodGet, true},
{"Distributions path disabled", "/distributions", "DockerDistributions", false, http.MethodGet, false},
{"Distribution path", "/distribution", "DockerDistribution", true, http.MethodGet, true},
{"Distribution path disabled", "/distribution", "DockerDistribution", false, http.MethodGet, false},
{"Events path", "/events", "DockerEvents", true, http.MethodGet, true},
{"Events path disabled", "/events", "DockerEvents", false, http.MethodGet, false},
@ -320,8 +320,8 @@ func TestNewDockerHandler_PathHandling(t *testing.T) {
env.DockerCommit = tt.envVarValue
case "DockerConfigs":
env.DockerConfigs = tt.envVarValue
case "DockerDistributions":
env.DockerDistributions = tt.envVarValue
case "DockerDistribution":
env.DockerDistribution = tt.envVarValue
case "DockerEvents":
env.DockerEvents = tt.envVarValue
case "DockerExec":

View file

@ -97,8 +97,8 @@ func NewDockerHandler() http.Handler {
if env.DockerConfigs {
allowedPaths = append(allowedPaths, "/configs")
}
if env.DockerDistributions {
allowedPaths = append(allowedPaths, "/distributions")
if env.DockerDistribution {
allowedPaths = append(allowedPaths, "/distribution")
}
if env.DockerEvents {
allowedPaths = append(allowedPaths, "/events")