Add App Install Command#157
Conversation
WalkthroughThis PR adds support for an ChangesApp install subcommand
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/flags/app.go`:
- Around line 56-62: The --set parsing loop (iterating args.SetOptions and
writing into options) can overwrite built-in-flag-typed fields (e.g., --port)
with strings; update the logic in the block that processes args.SetOptions to
detect conflicts with existing built-in flags/keys (inspect the options map or
the canonical flag names like "port") and either reject the --set entry with a
clear error or coerce the string to the built-in type before writing; ensure you
reference and check the same keys used by built-in flags (e.g., "port") so a
--set of a built-in flag does not silently replace an int with a string.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2ac8042b-ab2d-4b9b-9c0c-5e925f044457
📒 Files selected for processing (5)
cmd/runtipi/main.gointernal/commands/app.gointernal/flags/app.gointernal/types/args.gomise.toml
| for _, option := range args.SetOptions { | ||
| key, value, ok := strings.Cut(option, "=") | ||
| if !ok || key == "" { | ||
| return nil, fmt.Errorf("invalid --set value %q. Expected key=value", option) | ||
| } | ||
| options[key] = value | ||
| } |
There was a problem hiding this comment.
Type inconsistency: --set values can overwrite built-in flags with strings instead of typed values.
When a user provides --set port=8080, the code stores "8080" (string) in options["port"], but the built-in --port flag stores an int. This creates two problems:
- Type mismatch: The API receives mixed types for the same field depending on which flag was used.
- Silent overwrite: If both
--port 8080and--set port=9090are specified, the--setsilently overwrites the typed int with the string"9090".
This could cause the API to reject the request or misinterpret the value.
🛡️ Proposed fix: detect and prevent conflicts
Add validation before processing --set options to detect conflicts with built-in flags:
+ // Known built-in option keys
+ knownOptions := map[string]bool{
+ "port": true, "maxBackups": true, "domain": true, "localSubdomain": true,
+ "exposed": true, "exposedLocal": true, "openPort": true,
+ "isVisibleOnGuestDashboard": true, "enableAuth": true,
+ "skipEnv": true, "skipPull": true, "skipRun": true, "forcePull": true,
+ }
+
for _, option := range args.SetOptions {
key, value, ok := strings.Cut(option, "=")
if !ok || key == "" {
return nil, fmt.Errorf("invalid --set value %q. Expected key=value", option)
}
+ if knownOptions[key] {
+ return nil, fmt.Errorf("--set key %q conflicts with built-in flag --%s. Use the built-in flag instead", key, flagNameFromKey(key))
+ }
options[key] = value
}Alternatively, document that --set is only for custom app-specific fields, not built-in options.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/flags/app.go` around lines 56 - 62, The --set parsing loop
(iterating args.SetOptions and writing into options) can overwrite
built-in-flag-typed fields (e.g., --port) with strings; update the logic in the
block that processes args.SetOptions to detect conflicts with existing built-in
flags/keys (inspect the options map or the canonical flag names like "port") and
either reject the --set entry with a clear error or coerce the string to the
built-in type before writing; ensure you reference and check the same keys used
by built-in flags (e.g., "port") so a --set of a built-in flag does not silently
replace an int with a string.
|
Sorry, this PR was opened by a local Clanker 🤖 |
Summary by CodeRabbit
Release Notes
app installsubcommand to install applications with configurable options including port, backup limits, domain, visibility, and authentication settings--setflag for advanced configuration