fix: persist PlexServerURL to config during --install - #28
Conversation
The PLEX_URL argument passed to --install was only used in the systemd service file but never written to plexargod.conf. On new installations, PlexServerURL would fall back to localhost:32400 regardless of what was passed during install. Closes #27 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a93d918379
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if grep -q "^PlexServerURL=" /etc/plexargod/plexargod.conf 2>/dev/null; then | ||
| sed -i "s|^PlexServerURL=.*|PlexServerURL=${PLEX_URL}|" /etc/plexargod/plexargod.conf | ||
| else | ||
| echo "PlexServerURL=${PLEX_URL}" >> /etc/plexargod/plexargod.conf |
There was a problem hiding this comment.
Quote PlexServerURL before persisting it to sourced config
When --install is run with a URL containing shell metacharacters (for example $(...), backticks, or & in a query string), these lines write it verbatim into /etc/plexargod/plexargod.conf. Later the script does source "${plexargod_conf}" at plexargod.sh:100-102, so Bash evaluates that text as code/root shell syntax instead of loading it as data. At minimum this breaks legitimate URLs with &, and in the worst case it allows unintended command execution the next time plexargod runs.
Useful? React with 👍 / 👎.
The conf file is sourced by bash, so unquoted URLs containing shell metacharacters (& $ backticks) would be interpreted as code. Single-quote the value to ensure it is treated as a literal string. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
PLEX_URLargument passed to--installwas only written into the systemd service file (ExecStartfor cloudflared) but never persisted toplexargod.confPlexServerURLwould always fall back tohttp://localhost:32400regardless of what URL was passed during installPlexServerURLtoplexargod.confduring--installCloses #27
Test plan
plexargod --install http://custom-host:32400and verifyPlexServerURL=http://custom-host:32400appears in/etc/plexargod/plexargod.confplexargod --install(no URL) and verifyPlexServerURL=http://localhost:32400is written to conf--installagain with a different URL and verify the existingPlexServerURLis updated (not duplicated)🤖 Generated with Claude Code