Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

more env#1195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
montanalow merged 1 commit intomasterfrommontana/css
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletionspgml-dashboard/src/utils/config.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,8 +49,8 @@ impl Config {
_ => "2.0K".to_string(),
};

let css_version =env_string_default("CSS_VERSION", "");
let js_version =env_string_default("JS_VERSION", "1");
let css_version =env!("CSS_VERSION");
let js_version =env!("JS_VERSION");

let css_extension = if dev_mode {
"css".to_string()
Expand All@@ -66,7 +66,7 @@ impl Config {
Config {
dev_mode,
database_url: env_string_default("DATABASE_URL", "postgres:///pgml"),
git_sha:env_string_required("GIT_SHA"),
git_sha:env!("GIT_SHA").to_string(),
sentry_dsn: env_string_optional("SENTRY_DSN"),
static_dir: env_path_default("DASHBOARD_STATIC_DIRECTORY", "static"),
cms_dir: env_path_default("DASHBOARD_CMS_DIRECTORY", "../pgml-cms"),
Expand All@@ -92,7 +92,7 @@ pub fn database_url<'a>() -> &'a str {
&CONFIG.database_url
}

pub fn git_sha<'a>() -> &'astr {
pub fn git_sha<'a>() -> &'aString {
&CONFIG.git_sha
}

Expand DownExpand Up@@ -150,12 +150,6 @@ fn env_is_set(name: &str) -> bool {
var(name).is_ok()
}

fn env_string_required(name: &str) -> String {
var(name)
.unwrap_or_else(|_| panic!("{} env variable is required for proper configuration", name))
.to_string()
}

fn env_string_default(name: &str, default: &str) -> String {
match var(name) {
Ok(value) => value,
Expand Down
11 changes: 6 additions & 5 deletionspgml-dashboard/src/utils/tabs.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,16 +19,17 @@ impl<'a> Tabs<'a> {
) -> anyhow::Result<Self>{
let default =match default{
Some(default) => default,
_ => tabs
.get(0)
.ok_or(anyhow!("There must be at least one tab."))?
.name,
_ =>{
tabs.get(0)
.ok_or(anyhow!("There must be at least one tab."))?
.name
}
};

let active = active
.and_then(|name|{
let found = tabs.iter().find(|tab| tab.name == name);

found.map(|tab| tab.name)
})
.unwrap_or(default);
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp