fix: refactors startup scripts to work with the new configuration#357
fix: refactors startup scripts to work with the new configuration#357MrFinchMkV wants to merge 2 commits intohassio-addons:mainfrom
Conversation
WalkthroughThis PR replaces the legacy Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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
Fix all issues with AI Agents 🤖
In @traccar/rootfs/etc/cont-init.d/traccar.sh:
- Around line 19-26: The backup/migration block assumes /config/traccar.xml
exists; add a check using bashio::fs.file_exists to only run mv
/config/traccar.xml -> /config/traccar.v5.12.xml when the source exists,
otherwise skip the mv and proceed to copy the default /etc/traccar/traccar.xml
into /config/traccar.xml; keep the existing error handling (bashio::exit.nok)
for the mv and cp commands and use the same paths and functions
(bashio::fs.file_exists, mv, cp) so the script won't exit with nok on fresh
installs that lack /config/traccar.xml.
🧹 Nitpick comments (1)
traccar/rootfs/etc/traccar/traccar.xml (1)
33-34: Consider noting the duplicate in the commented examples.
osmand.portis enabled here and also appears in the commented examples at line 92. This is harmless but could confuse users editing the file. A brief inline comment like<!-- already enabled above -->at line 92 would help clarity.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
traccar/rootfs/etc/cont-init.d/mysql.shtraccar/rootfs/etc/cont-init.d/traccar.shtraccar/rootfs/etc/traccar/hassio.xmltraccar/rootfs/etc/traccar/traccar.xml
💤 Files with no reviewable changes (1)
- traccar/rootfs/etc/traccar/hassio.xml
🔇 Additional comments (3)
traccar/rootfs/etc/traccar/traccar.xml (1)
6-23: LGTM!The default configuration entries are well-structured. Binding
web.addressto127.0.0.1is appropriate for the add-on running behind a proxy, and the H2 database defaults provide a working out-of-box experience.traccar/rootfs/etc/cont-init.d/mysql.sh (2)
24-38: LGTM - xmlstarlet usage is correct.The
-u(update) operations work correctly with the newtraccar.xmltemplate that includes placeholder entries. Note that if users have removed these entries from their config, the updates will silently do nothing - this is probably acceptable given the migration workflow creates a fresh config.
6-6: Correct the database configuration target for existing installations.This script modifies
/etc/traccar/traccar.xml(the template), which works for new installations sincetraccar.shcopies the template to/config/traccar.xmlon first run. However, for existing installations,traccar.shskips the copy step (lines 30–42) and only manages the database lock. This means database configuration updates frommysql.shwon't reach the active configuration file at/config/traccar.xml.Either modify
/config/traccar.xmldirectly in this script, or ensure the template is re-copied for existing installations if dynamic database updates are needed.Likely an incorrect or invalid review comment.
|
@frenck can you review and approve this change? |
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions. |
|
I hope this pull gets merged! |
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions. |
|
Bump |
Proposed Changes
Hey community,
Problem: The addon fails to start with current master traccar v6.10.
Finding: In v6.2 the configuration directive 'config.default' was removed.
Last working version with the current traccar config is 6.1.
To get version 6.2 up and running we need to remove 'config.default' from the configuration.
I tried to include the hassio.xml in order to keep the current workflow.
Sadly I wasn't able to archive it, so removed the file and migrated it's content into traccar.xml.
I was now able to start Traccar until version 6.8.
In version 6.9 the web.path changed from
.modernto.web. As it was hardcoded in the config it failed.Removing it fixed it.
As cleanup I removed all settings that had the same value as the default.
Some of my thoughts
Unremoved garbage backupfile
I know that my proposed changed will create a 'garbage' backup file.
But it was the best I could come up with to preserve the current configuration should it contain custom parameter.
Secrets in config
I'm aware that secrets are written to the config.
If the user and password combination is not uniq to the traccar addon, but a generic one my solution might need an improvement. But as I said - I failed to seperate it :(
Related Issues
Can we update to latest version 6.5 #334
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.