-
Notifications
You must be signed in to change notification settings - Fork 129
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
Use FriendlyNames #459
Use FriendlyNames #459
Conversation
Codecov Report
@@ Coverage Diff @@
## main #459 +/- ##
==========================================
- Coverage 50.29% 49.85% -0.45%
==========================================
Files 72 72
Lines 5700 7905 +2205
==========================================
+ Hits 2867 3941 +1074
- Misses 2501 3608 +1107
- Partials 332 356 +24
Continue to review full report at Codecov.
|
Nice features! I just built and tested here and it seems to always present a "diff" adding the property "name".
updating route httpbin {
"https_redirect_status_code": 426,
"id": "ca017d00-c80a-4831-b69c-c975fdef3509",
"name": "httpbin",
"path_handling": "v0",
"paths": [
"/"
],
"preserve_host": false,
"protocols": [
"http",
"https"
],
"regex_priority": 1,
"service": {
"id": "0567f908-7a05-42eb-b53a-a7500c0f7427"
+ "name": "httpbin"
},
"strip_path": false
}
updating plugin pre-function for route httpbin {
"config": {
"access": [
"return kong.response.exit(200, {["msg"] = "hello from my function" }, {['x-kong-function'] = '[masked]'})
"
],
"body_filter": [
],
"certificate": [
],
"functions": [
],
"header_filter": [
],
"log": [
],
"rewrite": [
]
},
"enabled": true,
"id": "49fe5c3a-779a-4a5f-a1b5-f6de9146fc1b",
"name": "pre-function",
"protocols": [
"http",
"https"
],
"route": {
"id": "ca017d00-c80a-4831-b69c-c975fdef3509"
+ "name": "httpbin"
}
}
Summary:
Created: 0
Updated: 2
Deleted: 0 kong.yml: ---
_format_version: "1.1"
services:
- name: httpbin
url: https://httpbin.org/anything
retries: 5
routes:
- path_handling: v0
protocols:
- http
- https
https_redirect_status_code: 426
name: httpbin
paths:
- /
preserve_host: false
regex_priority: 1
strip_path: false
plugins:
- name: pre-function
enabled: true
protocols:
- http
- https
config:
body_filter: []
certificate: []
header_filter: []
log: []
rewrite: []
functions: []
access:
- |
return kong.response.exit(200, {["msg"] = "hello from my function" }, {['x-kong-function'] = '${{ env "DECK_MY_VAR" }}'}) |
I see, the names are not loaded on the dump part. I'm not sure what is right way to do this. |
I think modifying the state/builder.go to integrate Names shall do the trick |
@carnei-ro would you mind trying this latest version ? |
@mmorel-35 It seems to be working as expected! |
Inspire by the the PR Kong#459 Use FriendlyNames. Use the ID and the email of a Developer https://github.com/Kong/deck/pull/459/files
Hi @hbagdi @mflendrich , any updates an this pull-request ? |
} | ||
|
||
func (r *FRoute) asKongRoute() *kong.Route { | ||
return &kong.Route{ID: kong.String(*r.ID), Name: kong.String(*r.Name)} |
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.
Name is not a required field for Route or Service.
Please guard dereferences with a nil check. The same applies to consumer because, at runtime, it may happen that the object may not have username (even though it is a required field).
This PR is too big and touches different aspects of code - it is very hard to review carefully. There are significant nil exceptions that are written all over the code as well - so please take care of those. |
Hi @mmorel-35 , are you still working on this? Any updates since the last request for changes? |
Hi @GGabriele , I'm sorry I couldn't find the time to work on this lately. I don't know when I'll be able to get back on this so feel free to take it over from now. |
would be pretty huge to get this available 🙏 the diffs are borderline useless in a lot of cases without this. |
@mmorel-35 thanks a LOT for your contribution! I've picked it and merged it in #662 |
Thank you @GGabriele 👍🏻 !!! |
Stores ID and Names for entities in memDB to print friendly names in logs
Fixes #417