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
config/lib
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