From 21ed214ba9e3508fa0437be522f141afd1020884 Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 31 May 2026 13:09:53 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E8=BF=87=E6=97=B6=E7=9A=84=20Docker=20=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=92=8C=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openflare_agent/internal/config/config.go | 9 ---- .../internal/config/config_test.go | 44 ------------------- 2 files changed, 53 deletions(-) diff --git a/openflare_agent/internal/config/config.go b/openflare_agent/internal/config/config.go index 4538186e..de331544 100644 --- a/openflare_agent/internal/config/config.go +++ b/openflare_agent/internal/config/config.go @@ -47,9 +47,6 @@ type Config struct { NginxVersion string `json:"-"` OpenrestyPath string `json:"openresty_path"` OpenrestyResolvers []string `json:"openresty_resolvers,omitempty"` - OpenrestyContainerName string `json:"openresty_container_name,omitempty"` - OpenrestyDockerImage string `json:"openresty_docker_image,omitempty"` - DockerBinary string `json:"docker_binary,omitempty"` DataDir string `json:"data_dir"` MainConfigPath string `json:"main_config_path"` RouteConfigPath string `json:"route_config_path"` @@ -79,9 +76,6 @@ type configFile struct { NodeIP string `json:"node_ip"` OpenrestyPath string `json:"openresty_path"` OpenrestyResolvers []string `json:"openresty_resolvers"` - OpenrestyContainerName string `json:"openresty_container_name"` - OpenrestyDockerImage string `json:"openresty_docker_image"` - DockerBinary string `json:"docker_binary"` DataDir string `json:"data_dir"` MainConfigPath string `json:"main_config_path"` RouteConfigPath string `json:"route_config_path"` @@ -124,9 +118,6 @@ func Load(path string) (*Config, error) { NodeIP: file.NodeIP, OpenrestyPath: file.OpenrestyPath, OpenrestyResolvers: append([]string{}, file.OpenrestyResolvers...), - OpenrestyContainerName: file.OpenrestyContainerName, - OpenrestyDockerImage: file.OpenrestyDockerImage, - DockerBinary: file.DockerBinary, DataDir: file.DataDir, MainConfigPath: file.MainConfigPath, RouteConfigPath: file.RouteConfigPath, diff --git a/openflare_agent/internal/config/config_test.go b/openflare_agent/internal/config/config_test.go index d80f99f4..2573591f 100644 --- a/openflare_agent/internal/config/config_test.go +++ b/openflare_agent/internal/config/config_test.go @@ -161,41 +161,6 @@ func TestLoadNormalizesExplicitResolvers(t *testing.T) { } } -func TestLoadKeepsDeprecatedDockerFieldsForCompatibility(t *testing.T) { - dir := t.TempDir() - configPath := filepath.Join(dir, "agent.json") - payload := map[string]any{ - "server_url": "http://127.0.0.1:3000", - "agent_token": "token", - "node_name": "edge-01", - "node_ip": "10.0.0.8", - "openresty_container_name": "openflare-openresty", - "openresty_docker_image": "openresty/openresty:alpine", - "docker_binary": "docker", - } - data, err := json.Marshal(payload) - if err != nil { - t.Fatalf("failed to marshal config: %v", err) - } - if err = os.WriteFile(configPath, data, 0o644); err != nil { - t.Fatalf("failed to write config: %v", err) - } - - cfg, err := Load(configPath) - if err != nil { - t.Fatalf("Load failed: %v", err) - } - if cfg.OpenrestyContainerName != "openflare-openresty" { - t.Fatalf("unexpected container name: %s", cfg.OpenrestyContainerName) - } - if cfg.OpenrestyDockerImage != "openresty/openresty:alpine" { - t.Fatalf("unexpected image: %s", cfg.OpenrestyDockerImage) - } - if cfg.DockerBinary != "docker" { - t.Fatalf("unexpected docker binary: %s", cfg.DockerBinary) - } -} - func TestLoadUsesCustomDataDirForGeneratedFiles(t *testing.T) { dir := t.TempDir() configPath := filepath.Join(dir, "agent.json") @@ -462,15 +427,6 @@ func TestSavePersistsMillisecondsAndOmitsRuntimeVersions(t *testing.T) { if _, ok := decoded["nginx_path"]; ok { t.Fatal("legacy nginx_path should not be persisted") } - if _, ok := decoded["openresty_container_name"]; ok { - t.Fatal("deprecated openresty_container_name should not be persisted by default") - } - if _, ok := decoded["openresty_docker_image"]; ok { - t.Fatal("deprecated openresty_docker_image should not be persisted by default") - } - if _, ok := decoded["docker_binary"]; ok { - t.Fatal("deprecated docker_binary should not be persisted by default") - } } func TestInitialAuthToken(t *testing.T) {