Replace the ENV variable with a config file

So it's safer to configure, as we don't need to pass env variables
to a docker run service. Also it's easier to configure without
needing to pass a whole lot of env vars.
This commit is contained in:
Marijn Koesen committed 2020-06-04 21:27:14 +02:00
1 parent f436385f67
commit 79a28d169e
5 files changed
+70 -24

No files matched your search

+37 -2
View File
@@ -1,7 +1,42 @@
## Usage
### Installation
The easiest way is to run the docker container and set it to restart always. This basically makes it a system service that will always run.
The easiest way this is to run the docker container and set it to restart always. This basically makes it a system service that will always run.
To make it safe and avoid passing credentials we're using a configuration file.
```shell
docker run --restart=always -e MODBUS_HOST=192.168.1.1 solaredge_modbus_mqtt:latest
mkdir /etc/solaredge_modbus_mqtt
chmod 700 /etc/solaredge_modbus_mqtt
cp config.yaml-dist /etc/solaredge_modbus_mqtt/config.yaml
docker run --name=solaredge_modbus_mqtt --restart=always --volume=/etc/solaredge_modbus_mqtt/config.yaml:/app/config.yaml marijnkoesen/solaredge_modbus_mqtt:latest
```
## For developers
### Building and running the docker image
```shell
docker build -t solaredge_modbus_mqtt:latest .
cp config.yaml-dist config.yaml
docker run --volume=$PWD/config.yaml:/app/config.yaml solaredge_modbus_mqtt:latest
```
### Running without docker
```shell
pip3 install -r requirements.txt
cp config.yaml-dist config.yaml
python3 solaredge_modbus_mqtt.py
```
### Running tests
```shell
pip3 install -r requirements.txt
python3 -m unittest
```