Set up an environment variable to toggle between dev and production schemas

This commit is contained in:
Savanni D'Gerinel 2023-12-07 09:56:10 -05:00
parent f3a453d151
commit a7d6d82ec2
2 changed files with 8 additions and 5 deletions

View File

@ -2,9 +2,10 @@ use gtk::prelude::*;
use std::env;
const APP_ID_DEV: &str = "com.luminescent-dreams.fitnesstrax.dev";
// const APP_ID_PROD: &str = "com.luminescent-dreams.fitnesstrax";
const APP_ID_PROD: &str = "com.luminescent-dreams.fitnesstrax";
const RESOURCE_BASE_PATH_DEV: &str = "/com/luminescent-dreams/fitnesstrax/dev/";
const RESOURCE_BASE_PATH_PROD: &str = "/com/luminescent-dreams/fitnesstrax/";
struct AppState {}
@ -13,10 +14,11 @@ struct AppWindow {
}
fn main() {
println!("Hello, world!");
let app_id = APP_ID_DEV;
let base_path = RESOURCE_BASE_PATH_DEV;
let (app_id, base_path) = if std::env::var_os("ENV") == Some("dev".into()) {
(APP_ID_DEV, RESOURCE_BASE_PATH_DEV)
} else {
(APP_ID_PROD, RESOURCE_BASE_PATH_PROD)
};
let settings = gio::Settings::new(app_id);

View File

@ -48,6 +48,7 @@
typeshare.packages."x86_64-linux".default
];
LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";
ENV = "dev";
};
};
}