Configuration - s-allius/tsun-gen3-proxy GitHub Wiki
Configuration procedure in general
The proxy requires some settings for operation, which can be taken from various sources. The internal default configuration is always read first. This contains all mandatory values and sensible default values. Other files, if available, are then parsed and the configuration is supplemented or replaced with the new values:
- read
default_config.toml
from the source dir - read env values
- read
config.json
from theconfig dir
- read
config.toml
from theconfig dir
- read json-file specified by the
--json_config
cli argument - read toml-file specified by the
--toml_config
cli argument
The lowest priority is therefore an Env variable and the highest a toml file, which is passed to the CLI.
Configuration procedure for the Home Assistant Add-on variant
If the proxy is operated as an HA add-on, the configuration is created in the add-on administration and transferred to the proxy as a json file (/data/options.json
).
The 6 steps for creating the configuration are as follows:
- read
default_config.toml
from the source dir - read env values to get the MQTT configuration for HA's mosquitto setup
- read
/homeassistant/tsun-proxy/config.json
if exists - read
/homeassistant/tsun-proxy/config.toml
if exists - read
/data/options.json
- NOT USED
If you want to set additional configuration values that are not supported by the add-on administration, you can create a config.json
or config.toml
file and put this into /addon_configs/{REPO}_<your addon's slug>
directory of your HA machine. This directory will be mapped into the add-on as /homeassistant/tsun-proxy/
directory. So the proxy can read the config.json
or config.toml
file. This will be logged in the protkoll of the add-on during the start.
If the add-on is installed locally, {REPO}
will be local. If the add-on is installed from a Github repository, {REPO} is a hashed identifier generated from the GitHub repository's. The <your addon's slug>
depends of the version you have installed.
You will find this information on the Info
page of you running add-on under hostname
:
So for this dev version the complete path will be: /addon_configs/c676133d_tsun-proxy-dev/config.json
Configuration procedure for the prebuild docker container
The 6 steps for creating the configuration are as follows:
- read
default_config.toml
from the source dir - read env values
- read
/home/tsun-proxy/config.json
if exists - read
/home/tsun-proxy/config.toml
if exists - NOT USED
- NOT USED
It is recommended that you only use config.toml (step 4). For security reasons, the MQTT credentials (MQTT_USER and MQTT_PASSWD) should be transferred via the environment and not be specified in plain text in config.toml. However, never set them in the Docker build command, as this can cause them to be displayed with Docker Inspect.