fix(instances)!: Preserve env variables values verbatim - #395
Conversation
2e442b8 to
89f1bc0
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates instance-related commands to correctly accept environment variables in KEY=VALUE form even when values contain commas, by preventing Kong鈥檚 default comma-splitting and handling parsing explicitly before shortcut-flag processing.
Changes:
- Set
sep:"none"for-e/--envon instance create/edit to avoid Kong splitting values on commas. - Pre-process
Envinto--set runtime.env=...entries before applying generic shortcut flags (create/edit/run). - Add helpers to split and encode env assignments as JSON map fragments for consistent patch parsing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/cmd/run.go | Pre-processes --env into --set entries before generic shortcut handling to support KEY=VALUE parsing. |
| internal/cmd/instances.go | Disables Kong comma-splitting for --env, adds env parsing helpers, and applies the same pre-processing for create/edit. |
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
craciunoiuc
left a comment
There was a problem hiding this comment.
Some comments my side 馃ズ
89f1bc0 to
5311264
Compare
5311264 to
a8d856f
Compare
|
@nurof3n tests failing 馃槼 Also please close copilot comments which no longer apply Looks much leaner now 馃 |
a8d856f to
937a9a1
Compare
469fb03 to
4dc1888
Compare
| } | ||
| mapp.SetMapIndex(key, val) | ||
|
|
||
| // Each input string is a single key=value entry. Split on the |
There was a problem hiding this comment.
Shouldn't this section also use sep? Right now, it's only being used for slices+structs, not maps.
There was a problem hiding this comment.
the map case now uses the same splitter, with sep
| return strings.Split(input, sep) | ||
| } | ||
|
|
||
| func splitStructValues(input string, s reflect.Value, sep string) []string { |
There was a problem hiding this comment.
馃 Hm, wait why aren't we just using splitStructValues here?
Also, again, I don't love methods like looksLikeStructField - this means it's going to magically try and work out how to parse something, which is unexpected and will make the user sad.
There was a problem hiding this comment.
deleted stuff like that, it now only uses splitValues
|
This is better though <3 I've renamed the title to indicate this is a breaking change. |
4dc1888 to
f628778
Compare
Signed-off-by: Alex-Andrei Cioc <andrei.cioc@unikraft.io>
f628778 to
0bd0fb7
Compare
Signed-off-by: Alex-Andrei Cioc <andrei.cioc@unikraft.io>
0bd0fb7 to
07bbaaa
Compare
Closes TOOL-1125