fix: configure Kafka brokers at runtime
This commit is contained in:
@@ -128,7 +128,7 @@
|
|||||||
|
|
||||||
"kafka": {
|
"kafka": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"brokers": ["kafka.118im.com:30835"],
|
"brokers": $KAFKA_BROKERS_JSON,
|
||||||
"client_id": "im-server",
|
"client_id": "im-server",
|
||||||
"consumer_group": "im-server",
|
"consumer_group": "im-server",
|
||||||
"dial_timeout_ms": 3000,
|
"dial_timeout_ms": 3000,
|
||||||
|
|||||||
@@ -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")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user