fix: configure Kafka brokers at runtime

This commit is contained in:
Your Name
2026-10-15 12:26:09 +08:00
parent ab572a6c36
commit 3b186298a0
2 changed files with 23 additions and 1 deletions
+22
View File
@@ -0,0 +1,22 @@
package main
import (
"os"
"strings"
"testing"
)
func TestDockerConfigUsesKafkaBrokersFromEnvironment(t *testing.T) {
content, err := os.ReadFile("../docker/tinode/config.template")
if err != nil {
t.Fatalf("read Docker config template: %v", err)
}
template := string(content)
if !strings.Contains(template, `"brokers": $KAFKA_BROKERS_JSON`) {
t.Fatal("Docker config template must render Kafka brokers from KAFKA_BROKERS_JSON")
}
if strings.Contains(template, "kafka.118im.com:30835") {
t.Fatal("Docker config template must not hard-code the public Kafka NodePort")
}
}