Content-Length: 381895 | pFad | http://github.com/postgresml/postgresml/commit/259ba1310db439f83063f2e6ad6638d80ddf580a

D4 Montana/norly (#1194) · postgresml/postgresml@259ba13 · GitHub
Skip to content

Commit 259ba13

Browse files
committed
Montana/norly (#1194)
1 parent 5b9847a commit 259ba13

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

pgml-dashboard/src/utils/config.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ impl Config {
4949
_ => "2.0K".to_string(),
5050
};
5151

52-
let css_version = env_string_default("CSS_VERSION", "");
53-
let js_version = env_string_default("JS_VERSION", "1");
52+
let css_version = env!("CSS_VERSION");
53+
let js_version = env!("JS_VERSION");
5454

5555
let css_extension = if dev_mode {
5656
"css".to_string()
@@ -66,7 +66,7 @@ impl Config {
6666
Config {
6767
dev_mode,
6868
database_url: env_string_default("DATABASE_URL", "postgres://github.com/pgml"),
69-
git_sha: env_string_required("GIT_SHA"),
69+
git_sha: env!("GIT_SHA").to_string(),
7070
sentry_dsn: env_string_optional("SENTRY_DSN"),
7171
static_dir: env_path_default("DASHBOARD_STATIC_DIRECTORY", "static"),
7272
cms_dir: env_path_default("DASHBOARD_CMS_DIRECTORY", "../pgml-cms"),
@@ -92,7 +92,7 @@ pub fn database_url<'a>() -> &'a str {
9292
&CONFIG.database_url
9393
}
9494

95-
pub fn git_sha<'a>() -> &'a str {
95+
pub fn git_sha<'a>() -> &'a String {
9696
&CONFIG.git_sha
9797
}
9898

@@ -150,12 +150,6 @@ fn env_is_set(name: &str) -> bool {
150150
var(name).is_ok()
151151
}
152152

153-
fn env_string_required(name: &str) -> String {
154-
var(name)
155-
.unwrap_or_else(|_| panic!("{} env variable is required for proper configuration", name))
156-
.to_string()
157-
}
158-
159153
fn env_string_default(name: &str, default: &str) -> String {
160154
match var(name) {
161155
Ok(value) => value,

pgml-dashboard/src/utils/tabs.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ impl<'a> Tabs<'a> {
1919
) -> anyhow::Result<Self> {
2020
let default = match default {
2121
Some(default) => default,
22-
_ => tabs
23-
.get(0)
24-
.ok_or(anyhow!("There must be at least one tab."))?
25-
.name,
22+
_ => {
23+
tabs.get(0)
24+
.ok_or(anyhow!("There must be at least one tab."))?
25+
.name
26+
}
2627
};
2728

2829
let active = active
2930
.and_then(|name| {
3031
let found = tabs.iter().find(|tab| tab.name == name);
31-
32+
3233
found.map(|tab| tab.name)
3334
})
3435
.unwrap_or(default);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgresml/postgresml/commit/259ba1310db439f83063f2e6ad6638d80ddf580a

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy