This commit is contained in:
Tobias Reisinger 2024-04-30 01:45:08 +02:00
commit 5e19a4e603
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
8 changed files with 93 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.out

8
PklProject Normal file
View file

@ -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"
}

4
PklProject.deps.json Normal file
View file

@ -0,0 +1,4 @@
{
"schemaVersion": 1,
"resolvedDependencies": {}
}

18
controller.pkl Normal file
View file

@ -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"
}

18
core.pkl Normal file
View file

@ -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"
}

15
lib/common.pkl Normal file
View file

@ -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
}

17
lib/controller.pkl Normal file
View file

@ -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<RelayConfig>

12
lib/core.pkl Normal file
View file

@ -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<String>