Skip to content
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

Merged
merged 8 commits into from
May 13, 2021
Merged

feat: cluster address in env (close #131) #133

merged 8 commits into from
May 13, 2021

Conversation

GGXXLL
Copy link
Contributor

@GGXXLL GGXXLL commented May 10, 2021

No description provided.

@codecov
Copy link

codecov bot commented May 10, 2021

Codecov Report

Merging #133 (9535408) into master (5d7b442) will increase coverage by 0.14%.
The diff coverage is 96.49%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
queue/redis_driver.go 63.69% <0.00%> (+1.19%) ⬆️
otredis/provider.go 77.90% <50.00%> (+2.62%) ⬆️
otes/provider.go 79.41% <100.00%> (-0.87%) ⬇️
otetcd/dependency.go 92.59% <100.00%> (-0.27%) ⬇️
otgorm/dependency.go 88.13% <100.00%> (-0.39%) ⬇️
otkafka/dependency.go 87.80% <100.00%> (+0.62%) ⬆️
otkafka/reader_config.go 100.00% <100.00%> (ø)
otkafka/writer_config.go 100.00% <100.00%> (ø)
otmongo/provider.go 80.39% <100.00%> (-0.74%) ⬇️
ots3/dependency.go 67.79% <100.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d7b442...9535408. Read the comment docs.

@GGXXLL GGXXLL requested review from Reasno and lingwei0604 and removed request for Reasno May 11, 2021 07:30
Copy link
Member

@Reasno Reasno left a 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)

log:
level: none
kafka:
reader:
default:
brokers:
- ` + os.Getenv("KAFKA_ADDR") + `
` + brokersStr + `
Copy link
Member

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.

Copy link
Contributor Author

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")
)

@GGXXLL GGXXLL requested review from Reasno and removed request for lingwei0604 May 12, 2021 07:52
@Reasno Reasno merged commit f89361d into DoNewsCode:master May 13, 2021
@GGXXLL GGXXLL deleted the env-cluster branch May 14, 2021 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants