-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Change Zipkin CORS origins and headers to comma separated list #1556
Change Zipkin CORS origins and headers to comma separated list #1556
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1556 +/- ##
==========================================
- Coverage 98.36% 98.32% -0.05%
==========================================
Files 193 193
Lines 9364 9364
==========================================
- Hits 9211 9207 -4
- Misses 119 122 +3
- Partials 34 35 +1
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.
Could you add tests?
@yurishkuro Well, it's just an edit of what I added in #1463, where you told me there are no tests? If I do want me to write some, could you point me in the direction of where I'm supposed to add them? |
I also based myself on how arrays are handled in the storage plugins, but I'm not sure if this is the right way. Can Viper handle arrays like this? For example, in yaml:
As far as I understand the format above is not going to work, but this format would:
I could be wrong of course, haven't gotten the time yet to test it, it's just all just how I interpret the code. Although if I am right, I would suggest taking a look if we could somehow use both (to provide backwards compatibility). The first example is much more human readable than the second one, in my opinion. If I'm wrong, do correct me! Can always have missed something. |
I don't know about your Viper question, you'd have to try. My earlier comment about no-testing was in relation to CORS functionality. But we do have tests for parsing command line parameters:
|
It seems I was right, only the second one works, arrays don't work. I'll see if I can fix that.
@yurishkuro the only test I can see there is |
@@ -225,10 +226,13 @@ func startZipkinHTTPAPI( | |||
r := mux.NewRouter() | |||
zHandler.RegisterRoutes(r) | |||
|
|||
origins := strings.Split(strings.Replace(allowedOrigins, " ", "", -1), ",") | |||
headers := strings.Split(strings.Replace(allowedHeaders, " ", "", -1), ",") |
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.
we shouldn't do this in main, it is better to encapsulate this into the builder, similar to this:
jaeger/cmd/agent/app/reporter/grpc/flags.go
Lines 47 to 50 in 4ed618d
hostPorts := v.GetString(collectorHostPort) | |
if hostPorts != "" { | |
b.CollectorHostPorts = strings.Split(hostPorts, ",") | |
} |
@JonasVerhofste do you plan to finish this one? |
@yurishkuro Sure, but I'm still wondering where I should add those tests. Like I noted before, |
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Jonas Verhofsté 25819942+JonasVerhofste@users.noreply.github.com
Which problem is this PR solving?
When I implemented the CORS handling in f9702c4 (#1463), I forgot that there can be more than one origin and one header. This adds the functionality of specifying multiple origins and headers as a comma separated list.