Remove the _local directory again

This commit is contained in:
Tobias Reisinger 2024-03-04 16:09:03 +01:00
parent 3d66ca2472
commit 79327d2efa
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
10 changed files with 10 additions and 15 deletions

2
.env
View file

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

1
.gitignore vendored
View file

@ -4,7 +4,6 @@
/tests/testing_bak/ /tests/testing_bak/
/tests/testing_latest/ /tests/testing_latest/
/_local/
emgauwa-*.sqlite emgauwa-*.sqlite
emgauwa-*.sqlite-* emgauwa-*.sqlite-*
emgauwa-*.json emgauwa-*.json

View file

@ -7,9 +7,9 @@ sqlx:
build-rpi: build-rpi:
cross build --target arm-unknown-linux-gnueabihf cross build --target arm-unknown-linux-gnueabihf
_local/emgauwa-%.json: config/emgauwa-%.pkl config/lib/%.pkl config/lib/common.pkl emgauwa-%.json: config/emgauwa-%.pkl config/lib/%.pkl config/lib/common.pkl
pkl eval -f json -o $@ $< pkl eval -f json -o $@ $<
configs: configs:
$(MAKE) _local/emgauwa-core.json $(MAKE) emgauwa-core.json
$(MAKE) _local/emgauwa-controller.json $(MAKE) emgauwa-controller.json

View file

@ -5,7 +5,7 @@ server {
port = 4419 port = 4419
} }
database = "sqlite://_local/emgauwa-controller.sqlite" database = "sqlite://emgauwa-controller.sqlite"
permissions { permissions {
user = "emgauwa" user = "emgauwa"

View file

@ -5,7 +5,7 @@ server {
port = 4419 port = 4419
} }
database = "sqlite://_local/emgauwa-core.sqlite" database = "sqlite://emgauwa-core.sqlite"
permissions { permissions {
user = "emgauwa" user = "emgauwa"

View file

@ -32,7 +32,7 @@ impl Default for Settings {
fn default() -> Self { fn default() -> Self {
Settings { Settings {
server: settings::Server::default(), server: settings::Server::default(),
database: String::from("sqlite://_local/emgauwa-controller.sqlite"), database: String::from("sqlite://emgauwa-controller.sqlite"),
permissions: settings::Permissions::default(), permissions: settings::Permissions::default(),
logging: settings::Logging::default(), logging: settings::Logging::default(),

View file

@ -1,3 +1,3 @@
fn main() { fn main() {
println!("cargo:rustc-env=DATABASE_URL=sqlite://_local/emgauwa-core.sqlite") println!("cargo:rustc-env=DATABASE_URL=sqlite://emgauwa-core.sqlite")
} }

View file

@ -18,7 +18,7 @@ impl Default for Settings {
fn default() -> Self { fn default() -> Self {
Settings { Settings {
server: settings::Server::default(), server: settings::Server::default(),
database: String::from("sqlite://_local/emgauwa-core.sqlite"), database: String::from("sqlite://emgauwa-core.sqlite"),
permissions: settings::Permissions::default(), permissions: settings::Permissions::default(),
logging: settings::Logging::default(), logging: settings::Logging::default(),

View file

@ -1,4 +1,4 @@
fn main() { fn main() {
println!("cargo:rerun-if-changed=migrations"); println!("cargo:rerun-if-changed=migrations");
println!("cargo:rustc-env=DATABASE_URL=sqlite://_local/emgauwa-dev.sqlite"); println!("cargo:rustc-env=DATABASE_URL=sqlite://emgauwa-dev.sqlite");
} }

View file

@ -58,13 +58,9 @@ pub fn load<T>(config_name: &str, env_prefix: &str) -> Result<T, EmgauwaError>
where where
for<'de> T: serde::Deserialize<'de>, for<'de> T: serde::Deserialize<'de>,
{ {
// TODO: Add switch to only include local config if in development mode
let dev_file =
config::File::with_name(&format!("./_local/emgauwa-{}", config_name)).required(false);
let local_file = config::File::with_name(&format!("./emgauwa-{}", config_name)).required(false); let local_file = config::File::with_name(&format!("./emgauwa-{}", config_name)).required(false);
config::Config::builder() config::Config::builder()
.add_source(dev_file)
.add_source(local_file) .add_source(local_file)
.add_source( .add_source(
config::Environment::with_prefix(&format!("EMGAUWA_{}", env_prefix)) config::Environment::with_prefix(&format!("EMGAUWA_{}", env_prefix))