From 6340cfd5c752c63d2d4268580f4563af917c75c8 Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Tue, 30 Apr 2024 01:50:43 +0200 Subject: [PATCH] Remove to pkl project --- Makefile | 5 +---- config/PklProject | 8 -------- config/PklProject.deps.json | 4 ---- config/controller.pkl | 21 ++------------------- config/core.pkl | 19 +------------------ config/lib/common.pkl | 15 --------------- config/lib/controller.pkl | 17 ----------------- config/lib/core.pkl | 12 ------------ emgauwa-controller/src/ws/mod.rs | 2 +- 9 files changed, 5 insertions(+), 98 deletions(-) delete mode 100644 config/PklProject delete mode 100644 config/PklProject.deps.json delete mode 100644 config/lib/common.pkl delete mode 100644 config/lib/controller.pkl delete mode 100644 config/lib/core.pkl diff --git a/Makefile b/Makefile index 3ead12b..7c49652 100644 --- a/Makefile +++ b/Makefile @@ -7,16 +7,13 @@ sqlx: build-rpi: cross build --target arm-unknown-linux-gnueabihf -emgauwa-%.json: config/%.pkl config/lib/%.pkl +emgauwa-%.json: config/%.pkl pkl eval -f json -o $@ $< configs: $(MAKE) emgauwa-core.json $(MAKE) emgauwa-controller.json -pkl-package: - pkl project package config --output-path "./out/pkl" - clean: rm -f emgauwa-controller.json rm -f emgauwa-controller.sqlite diff --git a/config/PklProject b/config/PklProject deleted file mode 100644 index bc7911f..0000000 --- a/config/PklProject +++ /dev/null @@ -1,8 +0,0 @@ -amends "pkl:Project" - -package { - name = "emgauwa" - baseUri = "package://emgauwa.app/pkl/\(name)" - version = "0.1.0" - packageZipUrl = "https://emgauwa.app/pkl/\(name)@\(version).zip" -} \ No newline at end of file diff --git a/config/PklProject.deps.json b/config/PklProject.deps.json deleted file mode 100644 index 836079a..0000000 --- a/config/PklProject.deps.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "schemaVersion": 1, - "resolvedDependencies": {} -} \ No newline at end of file diff --git a/config/controller.pkl b/config/controller.pkl index 8eb74ce..11e735e 100644 --- a/config/controller.pkl +++ b/config/controller.pkl @@ -1,21 +1,4 @@ -amends "./lib/controller.pkl" - -server { - host = "127.0.0.1" - port = 4419 -} - -database = "sqlite://emgauwa-controller.sqlite" - -permissions { - user = "" // read("env:USER") - group = "" // read("env:USER") -} - -logging { - level = "INFO" - file = "stdout" -} +amends "package://emgauwa.app/pkl/emgauwa@0.1.0#/controller.pkl" relays { new { @@ -70,4 +53,4 @@ relays { pin = 21 inverted = false } -} +} \ No newline at end of file diff --git a/config/core.pkl b/config/core.pkl index dd63722..92c294a 100644 --- a/config/core.pkl +++ b/config/core.pkl @@ -1,18 +1 @@ -amends "./lib/core.pkl" - -server { - host = "127.0.0.1" - port = 4419 -} - -database = "sqlite://emgauwa-core.sqlite" - -permissions { - user = "" // read("env:USER") - group = "" // read("env:USER") -} - -logging { - level = "INFO" - file = "stdout" -} +amends "package://emgauwa.app/pkl/emgauwa@0.1.0#/core.pkl" diff --git a/config/lib/common.pkl b/config/lib/common.pkl deleted file mode 100644 index 5d223d0..0000000 --- a/config/lib/common.pkl +++ /dev/null @@ -1,15 +0,0 @@ -class ServerConfig { - host: String - port: UInt16 -} - -/// Set to a user and a group to drop privileges to after binding to the port -class PermissionsConfig { - user: String - group: String -} - -class LoggingConfig { - level: "TRACE"|"DEBUG"|"INFO"|"WARN"|"ERROR"|"FATAL" - file: String -} diff --git a/config/lib/controller.pkl b/config/lib/controller.pkl deleted file mode 100644 index 51417d6..0000000 --- a/config/lib/controller.pkl +++ /dev/null @@ -1,17 +0,0 @@ -import "./common.pkl" - -server: common.ServerConfig - -database: String - -permissions: common.PermissionsConfig - -logging: common.LoggingConfig - -class RelayConfig { - driver: "null"|"gpio"|"piface" - pin: Number - inverted: Boolean - pulse: Number(this >= 0)|Null = null -} -relays: Listing diff --git a/config/lib/core.pkl b/config/lib/core.pkl deleted file mode 100644 index d522e17..0000000 --- a/config/lib/core.pkl +++ /dev/null @@ -1,12 +0,0 @@ -import "./common.pkl" - -server: common.ServerConfig - -database: String - -permissions: common.PermissionsConfig - -logging: common.LoggingConfig - -/// Leave empty to allow all origins (will always respond with Origin and not "*") -origins: Listing diff --git a/emgauwa-controller/src/ws/mod.rs b/emgauwa-controller/src/ws/mod.rs index 83f91b0..e2a66fe 100644 --- a/emgauwa-controller/src/ws/mod.rs +++ b/emgauwa-controller/src/ws/mod.rs @@ -39,7 +39,7 @@ async fn run_websocket( log::debug!("Trying to connect to {}", url); match connect_async(url).await { Ok(connection) => { - log::debug!("Websocket connected"); + log::info!("Websocket connected"); let (ws_stream, _) = connection; let (mut write, read) = ws_stream.split();