Refactor project
This commit is contained in:
parent
6c75b0ab72
commit
f09bfe9db3
12 changed files with 77 additions and 70 deletions
11
.release
Executable file
11
.release
Executable 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/
|
||||
8
PklProject
Normal file
8
PklProject
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
amends "pkl:Project"
|
||||
|
||||
package {
|
||||
name = "emgauwa"
|
||||
baseUri = "package://emgauwa.app/pkl/\(name)"
|
||||
version = "0.2.2"
|
||||
packageZipUrl = "https://emgauwa.app/pkl/\(name)@\(version).zip"
|
||||
}
|
||||
17
common.pkl
Normal file
17
common.pkl
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
module emgauwa.common
|
||||
|
||||
class ServerConfig {
|
||||
host: String
|
||||
port: UInt16
|
||||
token: String
|
||||
}
|
||||
|
||||
/// 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"
|
||||
}
|
||||
|
|
@ -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
20
controller_example.pkl
Normal 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"
|
||||
23
core.pkl
23
core.pkl
|
|
@ -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
18
core_example.pkl
Normal 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"
|
||||
}
|
||||
13
doc-package-info.pkl
Normal file
13
doc-package-info.pkl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/// Emgauwa is a project to manage the automated switching of relays.
|
||||
amends "pkl:DocPackageInfo"
|
||||
|
||||
name = "Emgauwa"
|
||||
version = "0.2.2"
|
||||
importUri = "https://emgauwa.app/"
|
||||
|
||||
sourceCode = "https://git.serguzim.me/emgauwa/pkl"
|
||||
sourceCodeUrlScheme = "\(sourceCode)/src/tag/v\(version)%{path}#L%{line}"
|
||||
issueTracker = "https://git.serguzim.me/emgauwa/pkl/issues"
|
||||
authors {
|
||||
"tobias@msrg.cc"
|
||||
}
|
||||
3
docsite-info.pkl
Normal file
3
docsite-info.pkl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
amends "pkl:DocsiteInfo"
|
||||
|
||||
title = "Emgauwa"
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
6
release
6
release
|
|
@ -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/
|
||||
Loading…
Reference in a new issue