commit 5e19a4e6039708dcb262c5214c52c93acbbbbd29 Author: Tobias Reisinger Date: Tue Apr 30 01:45:08 2024 +0200 Init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab87873 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.out diff --git a/PklProject b/PklProject new file mode 100644 index 0000000..bc7911f --- /dev/null +++ b/PklProject @@ -0,0 +1,8 @@ +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/PklProject.deps.json b/PklProject.deps.json new file mode 100644 index 0000000..836079a --- /dev/null +++ b/PklProject.deps.json @@ -0,0 +1,4 @@ +{ + "schemaVersion": 1, + "resolvedDependencies": {} +} \ No newline at end of file diff --git a/controller.pkl b/controller.pkl new file mode 100644 index 0000000..6ada2ba --- /dev/null +++ b/controller.pkl @@ -0,0 +1,18 @@ +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" +} diff --git a/core.pkl b/core.pkl new file mode 100644 index 0000000..dd63722 --- /dev/null +++ b/core.pkl @@ -0,0 +1,18 @@ +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" +} diff --git a/lib/common.pkl b/lib/common.pkl new file mode 100644 index 0000000..5d223d0 --- /dev/null +++ b/lib/common.pkl @@ -0,0 +1,15 @@ +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/lib/controller.pkl b/lib/controller.pkl new file mode 100644 index 0000000..51417d6 --- /dev/null +++ b/lib/controller.pkl @@ -0,0 +1,17 @@ +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/lib/core.pkl b/lib/core.pkl new file mode 100644 index 0000000..d522e17 --- /dev/null +++ b/lib/core.pkl @@ -0,0 +1,12 @@ +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