From a1cae7b38cf31bea956059aae22ef1011348263b Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Tue, 21 May 2024 17:33:42 -0700 Subject: [PATCH] chore: split prod / dev for job db (#2216) * chore: split prod / dev for job db * update * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- crates/tabby/Cargo.toml | 2 +- ee/tabby-webserver/Cargo.toml | 2 +- ee/tabby-webserver/src/path.rs | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/tabby/Cargo.toml b/crates/tabby/Cargo.toml index 37f656def..cf54d12cc 100644 --- a/crates/tabby/Cargo.toml +++ b/crates/tabby/Cargo.toml @@ -15,7 +15,7 @@ vulkan = ["llama-cpp-server/vulkan"] # architecture, enable this feature to compile OpenSSL as part of the build. # See https://docs.rs/openssl/#vendored for more. static-ssl = ['openssl/vendored'] -prod = ["ee", 'tabby-webserver/prod-db'] +prod = ["ee", 'tabby-webserver/prod'] [dependencies] tabby-common = { path = "../tabby-common" } diff --git a/ee/tabby-webserver/Cargo.toml b/ee/tabby-webserver/Cargo.toml index 0e052d3fe..fbfb64059 100644 --- a/ee/tabby-webserver/Cargo.toml +++ b/ee/tabby-webserver/Cargo.toml @@ -6,7 +6,7 @@ authors.workspace = true homepage.workspace = true [features] -prod-db = [] +prod = [] [dependencies] anyhow.workspace = true diff --git a/ee/tabby-webserver/src/path.rs b/ee/tabby-webserver/src/path.rs index 5f0bca18a..a0c1379da 100644 --- a/ee/tabby-webserver/src/path.rs +++ b/ee/tabby-webserver/src/path.rs @@ -7,16 +7,17 @@ pub fn tabby_ee_root() -> PathBuf { } pub fn db_file() -> PathBuf { - #[cfg(feature = "prod-db")] - { + if cfg!(feature = "prod") { tabby_ee_root().join("db.sqlite") - } - #[cfg(not(feature = "prod-db"))] - { + } else { tabby_ee_root().join("dev-db.sqlite") } } pub fn job_db_file() -> PathBuf { - tabby_ee_root().join("job.sqlite") + if cfg!(feature = "prod") { + tabby_ee_root().join("job.sqlite") + } else { + tabby_ee_root().join("dev-job.sqlite") + } }