mirror of
https://github.com/hassio-addons/addon-wireguard.git
synced 2025-05-04 19:01:31 +00:00
print qrcode as text in logs
in order to get started quickly with the wireguard addon, it would be nice to have the qr code ready in the logs. else you'll need to use the File Editor add on, which does not allow by default access to the /ssl/wireguard folder. so this change would make it more beginner friendly.
This commit is contained in:
parent
c57f7e15e5
commit
8370506f25
2 changed files with 5 additions and 1 deletions
|
@ -35,7 +35,7 @@ Follow the following steps for installation & a quick start:
|
||||||
1. Forward port `51820` (UDP!) in your router to your Hass.io IP.
|
1. Forward port `51820` (UDP!) in your router to your Hass.io IP.
|
||||||
1. Download/Open the file `/ssl/wireguard/myphone/qrcode.png` stored on your
|
1. Download/Open the file `/ssl/wireguard/myphone/qrcode.png` stored on your
|
||||||
Hass.io machine, e.g., using Samba, Visual Studio Code or the Configurator
|
Hass.io machine, e.g., using Samba, Visual Studio Code or the Configurator
|
||||||
add-on.
|
add-on. You can also find the QR Code in the add-on logs.
|
||||||
1. Install the WireGuard app on your phone.
|
1. Install the WireGuard app on your phone.
|
||||||
1. Add a new WireGuard connection to your phone, by scanning the QR code.
|
1. Add a new WireGuard connection to your phone, by scanning the QR code.
|
||||||
1. Connect!
|
1. Connect!
|
||||||
|
|
|
@ -291,6 +291,10 @@ for peer in $(bashio::config 'peers|keys'); do
|
||||||
# Generate QR code with client configuration
|
# Generate QR code with client configuration
|
||||||
qrencode -t PNG -o "${config_dir}/qrcode.png" < "${config_dir}/client.conf"
|
qrencode -t PNG -o "${config_dir}/qrcode.png" < "${config_dir}/client.conf"
|
||||||
|
|
||||||
|
# Show QR code with client configuration in logs
|
||||||
|
bashio::log.info "QR code for peer ${name}:"
|
||||||
|
qrencode -t ANSI < "${config_dir}/client.conf"
|
||||||
|
|
||||||
# Store client name for the status API based on public key
|
# Store client name for the status API based on public key
|
||||||
filename=$(sha1sum <<< "${peer_public_key}" | awk '{ print $1 }')
|
filename=$(sha1sum <<< "${peer_public_key}" | awk '{ print $1 }')
|
||||||
echo -n "${name}" > "/var/lib/wireguard/${filename}"
|
echo -n "${name}" > "/var/lib/wireguard/${filename}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue