-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: cluster address in env (close #131) #133
Conversation
Codecov Report
@@ Coverage Diff @@
## master #133 +/- ##
==========================================
+ Coverage 77.10% 77.25% +0.14%
==========================================
Files 84 84
Lines 3219 3205 -14
==========================================
- Hits 2482 2476 -6
+ Misses 551 543 -8
Partials 186 186
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose was to intentionally skip the test if env is mot set. (So that the test passes on any environment)
otkafka/example_test.go
Outdated
log: | ||
level: none | ||
kafka: | ||
reader: | ||
default: | ||
brokers: | ||
- ` + os.Getenv("KAFKA_ADDR") + ` | ||
` + brokersStr + ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should escape brokerStr in some way. As an example, what if brokerStr contains a #?
The current version has the same problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose was to intentionally skip the test if env is mot set. (So that the test passes on any environment)
Ok, I understand. some question:
I think there should be only one place to read env. It shouldn't be read everywhere, So I added these global variables.
If possible, I can also add other non multiple envs. What do you think of this code?
// Default multiple addresses from env
var (
EnvDefaultElasticsearchAddrs = getDefaultAddrsFromEnv("ELASTICSEARCH_ADDR", "http://127.0.0.1:9200")
EnvDefaultEtcdAddrs = getDefaultAddrsFromEnv("ETCD_ADDR", "127.0.0.1:2379")
EnvDefaultKafkaAddrs = getDefaultAddrsFromEnv("KAFKA_ADDR", "127.0.0.1:9092")
EnvDefaultRedisAddrs = getDefaultAddrsFromEnv("REDIS_ADDR", "127.0.0.1:6379")
)
No description provided.