-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
15 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,6 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/usr/bin/with-contenv bashio | ||
# ============================================================================== | ||
# Community Hass.io Add-ons: Traccar | ||
# This files check if all user configuration requirements are met | ||
# ============================================================================== | ||
# shellcheck disable=SC1091 | ||
source /usr/lib/hassio-addons/base.sh | ||
|
||
# Check SSL requirements, if enabled | ||
if hass.config.true 'ssl'; then | ||
if ! hass.config.has_value 'certfile'; then | ||
hass.die 'SSL is enabled, but no certfile was specified' | ||
fi | ||
|
||
if ! hass.config.has_value 'keyfile'; then | ||
hass.die 'SSL is enabled, but no keyfile was specified' | ||
fi | ||
|
||
if ! hass.file_exists "/ssl/$(hass.config.get 'certfile')"; then | ||
hass.die 'The configured certfile is not found' | ||
fi | ||
|
||
if ! hass.file_exists "/ssl/$(hass.config.get 'keyfile')"; then | ||
hass.die 'The configured keyfile is not found' | ||
fi | ||
fi | ||
bashio::config.require.ssl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/usr/bin/with-contenv bashio | ||
# ============================================================================== | ||
# Community Hass.io Add-ons: Traccar | ||
# Ensures the user configuration file is present | ||
# ============================================================================== | ||
# shellcheck disable=SC1091 | ||
source /usr/lib/hassio-addons/base.sh | ||
|
||
if ! hass.file_exists "/config/traccar.xml"; then | ||
if ! bashio::fs.file_exists "/config/traccar.xml"; then | ||
cp /etc/traccar/traccar.xml /config/traccar.xml | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/usr/bin/with-contenv bashio | ||
# ============================================================================== | ||
# Community Hass.io Add-ons: Traccar | ||
# Configures NGINX for use with the Traccar server | ||
# ============================================================================== | ||
# shellcheck disable=SC1091 | ||
source /usr/lib/hassio-addons/base.sh | ||
|
||
declare certfile | ||
declare keyfile | ||
declare port | ||
|
||
if hass.config.true 'ssl'; then | ||
if bashio::config.true 'ssl'; then | ||
rm /etc/nginx/nginx.conf | ||
mv /etc/nginx/nginx-ssl.conf /etc/nginx/nginx.conf | ||
|
||
certfile=$(hass.config.get 'certfile') | ||
keyfile=$(hass.config.get 'keyfile') | ||
certfile=$(bashio::config 'certfile') | ||
keyfile=$(bashio::config 'keyfile') | ||
|
||
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/nginx.conf | ||
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/nginx.conf | ||
fi | ||
|
||
port=$(hass.config.get 'port') | ||
port=$(bashio::config 'port') | ||
sed -i "s/%%port%%/${port}/g" /etc/nginx/nginx.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/usr/bin/with-contenv bashio | ||
# ============================================================================== | ||
# Community Hass.io Add-ons: Traccar | ||
# Runs the Nginx daemon | ||
# ============================================================================== | ||
# shellcheck disable=SC1091 | ||
source /usr/lib/hassio-addons/base.sh | ||
|
||
bashio::log.info "Starting NGinx server..." | ||
exec nginx -g "daemon off;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters