Skip to content

Commit

Permalink
Migrate Traccar config out of Home Assistant config folder (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Nov 10, 2023
1 parent 1a6c19c commit 61469fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
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

0 comments on commit 61469fc

Please sign in to comment.