Improve config system
Add pkl to generate configs
This commit is contained in:
parent
8785186dfa
commit
b2ff632e64
47 changed files with 916 additions and 277 deletions
71
config/emgauwa-controller.pkl
Normal file
71
config/emgauwa-controller.pkl
Normal file
|
@ -0,0 +1,71 @@
|
|||
amends "./lib/controller.pkl"
|
||||
|
||||
server {
|
||||
host = "127.0.0.1"
|
||||
port = 4419
|
||||
}
|
||||
|
||||
database = "sqlite://_local/emgauwa-controller.sqlite"
|
||||
|
||||
permissions {
|
||||
user = "emgauwa"
|
||||
group = "emgauwa"
|
||||
}
|
||||
|
||||
logging {
|
||||
level = "DEBUG"
|
||||
file = "stdout"
|
||||
}
|
||||
|
||||
relays {
|
||||
new {
|
||||
driver = "gpio"
|
||||
pin = 5
|
||||
inverted = true
|
||||
}
|
||||
new {
|
||||
driver = "gpio"
|
||||
pin = 4
|
||||
inverted = true
|
||||
}
|
||||
new {
|
||||
driver = "gpio"
|
||||
pin = 3
|
||||
inverted = true
|
||||
}
|
||||
new {
|
||||
driver = "gpio"
|
||||
pin = 2
|
||||
inverted = true
|
||||
}
|
||||
new {
|
||||
driver = "gpio"
|
||||
pin = 1
|
||||
inverted = true
|
||||
}
|
||||
new {
|
||||
driver = "gpio"
|
||||
pin = 0
|
||||
inverted = true
|
||||
}
|
||||
new {
|
||||
driver = "gpio"
|
||||
pin = 16
|
||||
inverted = true
|
||||
}
|
||||
new {
|
||||
driver = "gpio"
|
||||
pin = 15
|
||||
inverted = true
|
||||
}
|
||||
new {
|
||||
driver = "piface"
|
||||
pin = 1
|
||||
inverted = false
|
||||
}
|
||||
new {
|
||||
driver = "piface"
|
||||
pin = 0
|
||||
inverted = false
|
||||
}
|
||||
}
|
18
config/emgauwa-core.pkl
Normal file
18
config/emgauwa-core.pkl
Normal file
|
@ -0,0 +1,18 @@
|
|||
amends "./lib/core.pkl"
|
||||
|
||||
server {
|
||||
host = "127.0.0.1"
|
||||
port = 4419
|
||||
}
|
||||
|
||||
database = "sqlite://_local/emgauwa-core.sqlite"
|
||||
|
||||
permissions {
|
||||
user = "emgauwa"
|
||||
group = "emgauwa"
|
||||
}
|
||||
|
||||
logging {
|
||||
level = "DEBUG"
|
||||
file = "stdout"
|
||||
}
|
15
config/lib/common.pkl
Normal file
15
config/lib/common.pkl
Normal 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: String
|
||||
file: String
|
||||
}
|
16
config/lib/controller.pkl
Normal file
16
config/lib/controller.pkl
Normal file
|
@ -0,0 +1,16 @@
|
|||
import "./common.pkl"
|
||||
|
||||
server: common.ServerConfig
|
||||
|
||||
database: String
|
||||
|
||||
permissions: common.PermissionsConfig
|
||||
|
||||
logging: common.LoggingConfig
|
||||
|
||||
class RelayConfig {
|
||||
driver: "gpio" | "piface"
|
||||
pin: Number
|
||||
inverted: Boolean
|
||||
}
|
||||
relays: Listing<RelayConfig>
|
12
config/lib/core.pkl
Normal file
12
config/lib/core.pkl
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue