Skip to content
Snippets Groups Projects
Commit 53a3dd05 authored by David Huss's avatar David Huss :speech_balloon:
Browse files

Use https when port 443, http otherwise

parent 242067d0
No related branches found
No related tags found
No related merge requests found
......@@ -60,15 +60,46 @@ sudo python3 /home/pi/.poetry/bin/poetry run stechuhr-client
```
### Run using venv
Run `setup_venv.sh` or use this:
```bash
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
pip3 install -r requirements.txt
python3 stechuhr_client/client.py
```
## Install and enable service
Install the systemd unit file:
```bash
cp stechuhr.service /etc/systemd/system/stechuhr.service
```
Enable and start:
```bash
systemctl enable stechuhr
systemctl start stechuhr
```
Check the output of the daemon:
```bash
journalctl -fu stechuhr
```
# Configuration
## Debugging
If you don't have a server connected you can test the basic (scanning and LED) functionality of the stechuhr-client by setting `dryrun = true` in the `config.toml`. Make sure to set `loglevel = "Debug"` as well so you can see what is going on later.
Check the output of `journalctl -fu stechuhr` to see the output messages.
## Location, Entrance & Direction
in `config.toml` there are three keys that identify a stechuhr.:
......@@ -101,3 +132,7 @@ success_repetitions = 5
success_off_time = "[0.05]"
success_on_time = "[0.05]"
```
## Server
Pretty much self explainatory
\ No newline at end of file
[Unit]
Description=Stechuhr-Client Service
Before=network.target
Wants=network.target
[Service]
Type=simple
User=c19daemon
Environment="STECHUHR_CLIENT_CONFIG_DIR=/etc/stechuhr-client/"
WorkingDirectory=/usr/local/bin/stechuhr-client
ExecStart=/usr/local/bin/stechuhr-client/env/bin/python3 /usr/local/bin/stechuhr-client/stechuhr_client/client.py
KillMode=process
TimeoutSec=900
Restart=on-failure
[Install]
WantedBy=multi-user.target
......@@ -157,7 +157,7 @@ def send_request(verified_id, config, logger) -> bool:
Send post request to stechuhr-server
Return true if everything was ok, false otherwise
"""
if config["server"]["verify_cert"]:
if int(config["server"]["port"]) == 443:
target_address = 'https://{}:{}/'.format(config["server"]["address"], config["server"]["port"])
else:
target_address = 'http://{}:{}/'.format(config["server"]["address"], config["server"]["port"])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment