Refactor project

This commit is contained in:
Tobias Reisinger 2026-07-19 21:01:32 +02:00
commit f09bfe9db3
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
12 changed files with 77 additions and 70 deletions

11
.release Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env sh
set -e
pkl eval core_example.pkl >/dev/null
pkl eval controller_example.pkl >/dev/null
pkldoc -o "$PWD/.out/docs" *.pkl
pkl project package --output-path="$PWD/.out" --skip-publish-check --overwrite
rclone copy -L .out/ scaleway:emgauwa-website.serguzim.me/

View file

@ -1,19 +1,22 @@
amends "./emgauwa/controller.pkl"
module emgauwa.controller
server {
host = "127.0.0.1"
port = 4419
import "./common.pkl"
server: common.ServerConfig
database: String
permissions: common.PermissionsConfig
logging: common.LoggingConfig
midnight: String(matches(Regex(#"([01]?[0-9]|2[0-3]):[0-5][0-9]"#)))
class RelayConfig {
number: Number
driver: "null"|"gpio"|"piface"
pin: Number
inverted: Boolean
pulse: Number(this >= 0)|Null = null
}
database = "sqlite://emgauwa-controller.sqlite"
permissions {
user = "" // read("env:USER")
group = "" // read("env:USER")
}
logging {
level = "INFO"
}
midnight = "00:00"
relays: Listing<RelayConfig>

20
controller_example.pkl Normal file
View file

@ -0,0 +1,20 @@
amends "./controller.pkl"
server {
host = "127.0.0.1"
port = 4419
token = ""
}
database = "sqlite://emgauwa-controller.sqlite"
permissions {
user = "" // read("env:USER")
group = "" // read("env:USER")
}
logging {
level = "INFO"
}
midnight = "00:00"

View file

@ -1,17 +1,14 @@
amends "./emgauwa/core.pkl"
module emgauwa.core
server {
host = "127.0.0.1"
port = 4419
}
import "./common.pkl"
database = "sqlite://emgauwa-core.sqlite"
server: common.ServerConfig
permissions {
user = "" // read("env:USER")
group = "" // read("env:USER")
}
database: String
logging {
level = "INFO"
}
permissions: common.PermissionsConfig
logging: common.LoggingConfig
/// Leave empty to allow all origins (will always respond with Origin and not "*")
origins: Listing<String>

18
core_example.pkl Normal file
View file

@ -0,0 +1,18 @@
amends "./core.pkl"
server {
host = "127.0.0.1"
port = 4419
token = ""
}
database = "sqlite://emgauwa-core.sqlite"
permissions {
user = "" // read("env:USER")
group = "" // read("env:USER")
}
logging {
level = "INFO"
}

View file

@ -6,7 +6,7 @@ version = "0.2.2"
importUri = "https://emgauwa.app/"
sourceCode = "https://git.serguzim.me/emgauwa/pkl"
sourceCodeUrlScheme = "\(sourceCode)/src/tag/v\(version)/lib%{path}#L%{line}"
sourceCodeUrlScheme = "\(sourceCode)/src/tag/v\(version)%{path}#L%{line}"
issueTracker = "https://git.serguzim.me/emgauwa/pkl/issues"
authors {
"tobias@msrg.cc"

View file

@ -1,22 +0,0 @@
module emgauwa.controller
import "./common.pkl"
server: common.ServerConfig
database: String
permissions: common.PermissionsConfig
logging: common.LoggingConfig
midnight: String(matches(Regex(#"([01]?[0-9]|2[0-3]):[0-5][0-9]"#)))
class RelayConfig {
number: Number
driver: "null"|"gpio"|"piface"
pin: Number
inverted: Boolean
pulse: Number(this >= 0)|Null = null
}
relays: Listing<RelayConfig>

View file

@ -1,14 +0,0 @@
module emgauwa.core
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>

View file

@ -1,6 +0,0 @@
#!/usr/bin/env sh
pkldoc -o "$PWD/.out/docs" emgauwa/*
pkl project package --output-path="$PWD/.out" --working-dir=emgauwa --skip-publish-check
rclone copy -L .out/ scaleway:emgauwa-website.serguzim.me/