begin restructure into two binaries

This commit is contained in:
Alex Janka 2024-12-28 13:48:59 +11:00
parent 983f2fe1a8
commit 5d2d310e6e
19 changed files with 36 additions and 3 deletions

View file

@ -6,11 +6,25 @@ license = "MITNFA"
description = "Controls Tesla charge rate based on solar charge data" description = "Controls Tesla charge rate based on solar charge data"
authors = ["Alex Janka"] authors = ["Alex Janka"]
[lib]
name = "common"
path = "src/lib/lib.rs"
[[bin]]
name = "tesla-charge-controller"
path = "src/bins/tesla/main.rs"
[[bin]]
name = "charge-controller-supervisor"
path = "src/bins/controllers/main.rs"
[package.metadata.deb] [package.metadata.deb]
maintainer-scripts = "debian/" maintainer-scripts = "pkg/debian/"
systemd-units = { enable = false } systemd-units = [
{ unit-name = "tesla-charge-controller", unit-scripts = "pkg/systemd/", enable = false },
{ unit-name = "charge-controller-supervisor", unit-scripts = "pkg/systemd/", enable = false },
]
depends = "" depends = ""
assets = [["target/release/tesla-charge-controller", "usr/bin/", "755"]]
[dependencies] [dependencies]
tesla-common = { git = "https://git.alexjanka.com/alex/tesla-common" } tesla-common = { git = "https://git.alexjanka.com/alex/tesla-common" }

0
pkg/debian/.empty Normal file
View file

View file

@ -0,0 +1,16 @@
[Unit]
Description=Charge Controller Supervisor
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=10s
User=tesla
Environment="RUST_LOG=error,warn"
Environment="LOG_TIMESTAMP=false"
ExecStart=/usr/bin/charge-controller-supervisor watch
[Install]
WantedBy=multi-user.target

View file

@ -1,6 +1,7 @@
[Unit] [Unit]
Description=Tesla Charge Controller Description=Tesla Charge Controller
After=network.target After=network.target
Requires=charge-controller-supervisor.service
StartLimitIntervalSec=0 StartLimitIntervalSec=0
[Service] [Service]

View file

@ -0,0 +1 @@
fn main() {}

1
src/bins/tesla/main.rs Normal file
View file

@ -0,0 +1 @@
fn main() {}