Skip to content
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

Migrate Traccar config out of Home Assistant config folder #261

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion traccar/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ been done to reduce the number of open ports the add-on would create.

By default, only the OsmAnd protocol (used by the Traccar Apps) and the API
are enabled. If you want more protocols, you can do so, by adding entries
to your `/config/traccar.xml` file.
to your `traccar.xml` file in the add-on configuration folder.

A list if all entries can be found here:

Expand Down
3 changes: 2 additions & 1 deletion traccar/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ ports:
ports_description:
80/tcp: Web interface
map:
- config:rw
- addon_config:rw
- homeassistant_config:rw
- ssl
services:
- mysql:want
Expand Down
8 changes: 8 additions & 0 deletions traccar/rootfs/etc/cont-init.d/traccar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ declare password
declare port
declare username

# Migrate add-on data from the Home Assistant config folder,
# to the add-on configuration folder.
if ! bashio::fs.directory_exists '/config/traccar.xml' \
&& bashio::fs.file_exists '/homeassistant/traccar.xml'; then
mv /homeassistant/traccar.xml /config/traccar.xml \
|| bashio::exit.nok "Failed to migrate Traccar configuration"
fi

if ! bashio::fs.file_exists "/config/traccar.xml"; then
cp /etc/traccar/traccar.xml /config/traccar.xml
else
Expand Down