Improve config (json) file creation

This commit is contained in:
Tobias Reisinger 2024-03-28 03:19:15 +01:00
parent 1d4e9efa15
commit 525eb21649
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
6 changed files with 91 additions and 84 deletions

1
.env
View file

@ -1 +0,0 @@
DATABASE_URL="sqlite://emgauwa-dev.sqlite"

19
.gitignore vendored
View file

@ -1,15 +1,8 @@
/target/
/tests/testing/
/tests/testing_bak/
/tests/testing_latest/
emgauwa-*.sqlite
emgauwa-*.sqlite-*
emgauwa-*.json
# Added by cargo
/target
/.env
/api.http
/emgauwa-*.sqlite
/emgauwa-*.sqlite-*
/emgauwa-*.json

View file

@ -1,5 +1,13 @@
ifneq (,$(wildcard ./.env))
include .env
export
endif
DATABASE_URL ?= sqlite://emgauwa-dev.sqlite
export DATABASE_URL
sqlx:
cargo sqlx database drop
cargo sqlx database drop -y
cargo sqlx database create
cargo sqlx migrate run
cargo sqlx prepare --workspace
@ -7,9 +15,16 @@ sqlx:
build-rpi:
cross build --target arm-unknown-linux-gnueabihf
emgauwa-%.json: config/emgauwa-%.pkl config/lib/%.pkl config/lib/common.pkl
emgauwa-%.json: config/emgauwa-%.pkl config/lib/%.pkl config/lib/common.pkl $(wildcard .env)
pkl eval -f json -o $@ $<
configs:
$(MAKE) emgauwa-core.json
$(MAKE) emgauwa-controller.json
clean:
rm -f emgauwa-controller.json
rm -f emgauwa-controller.sqlite
rm -f emgauwa-core.json
rm -f emgauwa-core.sqlite
rm -f emgauwa-dev.sqlite

View file

@ -13,7 +13,7 @@ permissions {
}
logging {
level = "DEBUG"
level = read?("env:LOGGING_LEVEL") ?? "DEBUG"
file = "stdout"
}

View file

@ -13,6 +13,6 @@ permissions {
}
logging {
level = "DEBUG"
level = read?("env:LOGGING_LEVEL") ?? "DEBUG"
file = "stdout"
}

View file

@ -10,6 +10,6 @@ class PermissionsConfig {
}
class LoggingConfig {
level: String
level: "TRACE"|"DEBUG"|"INFO"|"WARN"|"ERROR"|"FATAL"
file: String
}