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

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

@ -21,34 +21,34 @@ var (
AgentCACert string AgentCACert string
AgentSSLCert string AgentSSLCert string
DockerSocketAddr string DockerSocketAddr string
DockerPost bool DockerPost bool
DockerRestarts bool DockerRestarts bool
DockerStart bool DockerStart bool
DockerStop bool DockerStop bool
DockerAuth bool DockerAuth bool
DockerBuild bool DockerBuild bool
DockerCommit bool DockerCommit bool
DockerConfigs bool DockerConfigs bool
DockerContainers bool DockerContainers bool
DockerDistributions bool DockerDistribution bool
DockerEvents bool DockerEvents bool
DockerExec bool DockerExec bool
DockerGrpc bool DockerGrpc bool
DockerImages bool DockerImages bool
DockerInfo bool DockerInfo bool
DockerNetworks bool DockerNetworks bool
DockerNodes bool DockerNodes bool
DockerPing bool DockerPing bool
DockerPlugins bool DockerPlugins bool
DockerSecrets bool DockerSecrets bool
DockerServices bool DockerServices bool
DockerSession bool DockerSession bool
DockerSwarm bool DockerSwarm bool
DockerSystem bool DockerSystem bool
DockerTasks bool DockerTasks bool
DockerVersion bool DockerVersion bool
DockerVolumes bool DockerVolumes bool
) )
func init() { func init() {
@ -75,7 +75,7 @@ func Load() {
DockerCommit = common.GetEnvBool("COMMIT", false) DockerCommit = common.GetEnvBool("COMMIT", false)
DockerConfigs = common.GetEnvBool("CONFIGS", false) DockerConfigs = common.GetEnvBool("CONFIGS", false)
DockerContainers = common.GetEnvBool("CONTAINERS", false) DockerContainers = common.GetEnvBool("CONTAINERS", false)
DockerDistributions = common.GetEnvBool("DISTRIBUTIONS", false) DockerDistribution = common.GetEnvBool("DISTRIBUTION", false)
DockerEvents = common.GetEnvBool("EVENTS", true) DockerEvents = common.GetEnvBool("EVENTS", true)
DockerExec = common.GetEnvBool("EXEC", false) DockerExec = common.GetEnvBool("EXEC", false)
DockerGrpc = common.GetEnvBool("GRPC", 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", "/configs", "DockerConfigs", true, http.MethodGet, true},
{"Configs path disabled", "/configs", "DockerConfigs", false, http.MethodGet, false}, {"Configs path disabled", "/configs", "DockerConfigs", false, http.MethodGet, false},
{"Distributions path", "/distributions", "DockerDistributions", true, http.MethodGet, true}, {"Distribution path", "/distribution", "DockerDistribution", true, http.MethodGet, true},
{"Distributions path disabled", "/distributions", "DockerDistributions", false, http.MethodGet, false}, {"Distribution path disabled", "/distribution", "DockerDistribution", false, http.MethodGet, false},
{"Events path", "/events", "DockerEvents", true, http.MethodGet, true}, {"Events path", "/events", "DockerEvents", true, http.MethodGet, true},
{"Events path disabled", "/events", "DockerEvents", false, http.MethodGet, false}, {"Events path disabled", "/events", "DockerEvents", false, http.MethodGet, false},
@ -320,8 +320,8 @@ func TestNewDockerHandler_PathHandling(t *testing.T) {
env.DockerCommit = tt.envVarValue env.DockerCommit = tt.envVarValue
case "DockerConfigs": case "DockerConfigs":
env.DockerConfigs = tt.envVarValue env.DockerConfigs = tt.envVarValue
case "DockerDistributions": case "DockerDistribution":
env.DockerDistributions = tt.envVarValue env.DockerDistribution = tt.envVarValue
case "DockerEvents": case "DockerEvents":
env.DockerEvents = tt.envVarValue env.DockerEvents = tt.envVarValue
case "DockerExec": case "DockerExec":

View file

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