mirror of
https://codeberg.org/icewind/tasproxy.git
synced 2026-06-03 10:14:09 +02:00
fmt:
This commit is contained in:
parent
745376df6f
commit
e9a16ce546
5 changed files with 56 additions and 46 deletions
13
README.md
13
README.md
|
|
@ -8,7 +8,8 @@ Remembering what ip addresses all of your tasmota devices is a pain.
|
|||
|
||||
## Setup
|
||||
|
||||
Ensure your tasmota devices are connected to an MQTT server with the following "Full Topic":
|
||||
Ensure your tasmota devices are connected to an MQTT server with the following
|
||||
"Full Topic":
|
||||
|
||||
%prefix%/%topic%/
|
||||
|
||||
|
|
@ -22,12 +23,16 @@ Run the binary with the following environment variables
|
|||
- `MQTT_PASSWORD`: password to authenticate against the mqtt server
|
||||
- `PORT`: port this binary MQTT listen on, defaults to 80
|
||||
|
||||
You can also configure the proxy to send HTTP Basic authentication to the tasmota devices by setting the `TASMOTA_USERNAME` and `TASMOTA_PASSWORD` environment variables.
|
||||
You can also configure the proxy to send HTTP Basic authentication to the
|
||||
tasmota devices by setting the `TASMOTA_USERNAME` and `TASMOTA_PASSWORD`
|
||||
environment variables.
|
||||
|
||||
Setup dns/hosts/etc to point `*.example.com` to the server running this binary
|
||||
|
||||
## Usage
|
||||
|
||||
The proxy server will use MQTT to discover and gather the ip addresses of your tasmota devices.
|
||||
The proxy server will use MQTT to discover and gather the ip addresses of your
|
||||
tasmota devices.
|
||||
|
||||
Any request made to `%hostname%.example.com` will be proxied to the tasmota device with the corresponding topic.
|
||||
Any request made to `%hostname%.example.com` will be proxied to the tasmota
|
||||
device with the corresponding topic.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{ dockerTools
|
||||
, tasproxy
|
||||
{
|
||||
dockerTools,
|
||||
tasproxy,
|
||||
}:
|
||||
dockerTools.buildLayeredImage {
|
||||
name = "icewind1991/tasproxy";
|
||||
|
|
|
|||
24
module.nix
24
module.nix
|
|
@ -1,7 +1,8 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.services.tasproxy;
|
||||
|
|
@ -10,9 +11,11 @@ with lib; let
|
|||
listen = {
|
||||
inherit (cfg) socket;
|
||||
};
|
||||
mqtt = {
|
||||
mqtt =
|
||||
{
|
||||
inherit (cfg.mqtt) hostname port;
|
||||
} // (
|
||||
}
|
||||
// (
|
||||
optionalAttrs (cfg.mqtt.passwordFile != null) {
|
||||
inherit (cfg.mqtt) username;
|
||||
password_file = "$CREDENTIALS_DIRECTORY/mqtt_password";
|
||||
|
|
@ -23,8 +26,7 @@ with lib; let
|
|||
password_file = "$CREDENTIALS_DIRECTORY/tasmota_password";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.services.tasproxy = {
|
||||
enable = mkEnableOption "Log archiver";
|
||||
|
||||
|
|
@ -102,9 +104,11 @@ in
|
|||
wantedBy = ["multi-user.target"];
|
||||
|
||||
serviceConfig = {
|
||||
LoadCredential = (optional (cfg.mqtt.passwordFile != null) [
|
||||
LoadCredential =
|
||||
(optional (cfg.mqtt.passwordFile != null) [
|
||||
"mqtt_password:${cfg.mqtt.passwordFile}"
|
||||
]) ++ (optional (cfg.tasmota.passwordFile != null) [
|
||||
])
|
||||
++ (optional (cfg.tasmota.passwordFile != null) [
|
||||
"tasmota_password:${cfg.tasmota.passwordFile}"
|
||||
]);
|
||||
|
||||
|
|
|
|||
10
package.nix
10
package.nix
|
|
@ -1,8 +1,8 @@
|
|||
{ stdenv
|
||||
, rustPlatform
|
||||
, lib
|
||||
}:
|
||||
let
|
||||
{
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.sources) sourceByRegex;
|
||||
src = sourceByRegex ./. ["Cargo.*" "(src)(/.*)?"];
|
||||
in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue