fix cli configuration environment variable

This commit is contained in:
Evan Almloff committed 2023-11-14 15:50:04 -06:00
1 parent 06be18a591
commit 1ed66a54cc
6 files changed
+13 -81

No files matched your search

@@ -1,74 +0,0 @@
[application]
# dioxus project name
name = "{{project-name}}"
# default platfrom
# you can also use `dx serve/build --platform XXX` to use other platform
# value: web | desktop
default_platform = "{{default-platform}}"
# Web `build` & `serve` dist path
out_dir = "dist"
# resource (static) file folder
asset_dir = "public"
[web.app]
# HTML title tag content
title = "Dioxus | An elegant GUI library for Rust"
[web.watcher]
index_on_404 = true
watch_path = ["src", "examples"]
# include `assets` in web platform
[web.resource]
# CSS style file
style = []
# Javascript code file
script = []
[web.resource.dev]
# Javascript code file
# serve: [dev-server] only
script = []
[application.plugins]
available = true
required = []
[bundler]
# Bundle identifier
identifier = "io.github.{{project-name}}"
# Bundle publisher
publisher = "{{project-name}}"
# Bundle icon
icon = ["icons/icon.png"]
# Bundle resources
resources = ["public/*"]
# Bundle copyright
copyright = ""
# Bundle category
category = "Utility"
# Bundle short description
short_description = "An amazing dioxus application."
# Bundle long description
long_description = """
An amazing dioxus application.
"""
+1
View File
@@ -231,6 +231,7 @@ pub enum WebviewInstallMode {
FixedRuntime { path: PathBuf },
}
#[cfg(feature = "cli")]
impl WebviewInstallMode {
fn into(self) -> tauri_utils::config::WebviewInstallMode {
match self {
+8 -3
View File
@@ -46,8 +46,13 @@ impl std::error::Error for DioxusCLINotUsed {}
pub static CURRENT_CONFIG: once_cell::sync::Lazy<
Result<crate::config::CrateConfig, DioxusCLINotUsed>,
> = once_cell::sync::Lazy::new(|| {
std::env::var(crate::__private::CONFIG_ENV)
.ok()
CURRENT_CONFIG_JSON
.and_then(|config| serde_json::from_str(&config).ok())
.ok_or(DioxusCLINotUsed)
.ok_or_else(|| {
tracing::error!("A library is trying to access the crate's configuration, but the dioxus CLI was not used to build the application.");
DioxusCLINotUsed
})
});
/// The current crate's configuration.
pub const CURRENT_CONFIG_JSON: Option<&str> = std::option_env!("DIOXUS_CONFIG");