Compare commits
No commits in common. "12614078ad78df0646fb6a3913db2d5b16edca32" and "b7b303afb3e68b6959c140fe04742b8606f7d8ac" have entirely different histories.
12614078ad
...
b7b303afb3
|
@ -7,7 +7,6 @@ services:
|
|||
networks:
|
||||
bfile:
|
||||
volumes:
|
||||
- './.git:/opt/code/.git'
|
||||
- './filed:/opt/code'
|
||||
- './filed/config:/etc/filed'
|
||||
- '/opt/code/target'
|
||||
|
|
|
@ -17,19 +17,6 @@ fn extfilter(valid: String, x: Option<&OsStr>) -> bool {
|
|||
ext == valid
|
||||
}
|
||||
|
||||
fn system(cmd: &str, args: &[&str]) -> String {
|
||||
let out = Command::new(cmd)
|
||||
.args(args)
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
if out.stderr.len() != 0 {
|
||||
panic!("Got this while running {cmd} with \"{}\": {}", args.join(" "), String::from_utf8(out.stderr).unwrap())
|
||||
}
|
||||
|
||||
String::from_utf8(out.stdout).unwrap()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
println!("cargo:rerun-if-changed=static/assets");
|
||||
|
@ -71,11 +58,5 @@ fn main() {
|
|||
.arg(asset_path(asset))
|
||||
.spawn()
|
||||
.unwrap();
|
||||
});
|
||||
|
||||
let commit = system("git", &["rev-parse", "HEAD"]);
|
||||
let branch = system("git", &["rev-parse", "--abbrev-ref", "HEAD"]);
|
||||
|
||||
println!("cargo:rustc-env=COMMIT_HASH={commit}");
|
||||
println!("cargo:rustc-env=COMMIT_BRANCH={branch}");
|
||||
})
|
||||
}
|
|
@ -15,23 +15,6 @@ pub struct Redis {
|
|||
pub prefix: String
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct VersionData {
|
||||
pub commit: String,
|
||||
pub short_commit: String,
|
||||
pub branch: String
|
||||
}
|
||||
|
||||
impl Default for VersionData {
|
||||
fn default() -> Self {
|
||||
VersionData {
|
||||
commit: env!("COMMIT_HASH").to_string(),
|
||||
short_commit: env!("COMMIT_HASH").to_string().chars().take(6).collect(),
|
||||
branch: env!("COMMIT_BRANCH").to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Env {
|
||||
pub logging: bool,
|
||||
|
@ -41,8 +24,7 @@ pub struct Env {
|
|||
pub filedir: String,
|
||||
pub instanceurl: String,
|
||||
pub uploadspath: String,
|
||||
pub confpath: String,
|
||||
pub version: VersionData
|
||||
pub confpath: String
|
||||
}
|
||||
|
||||
fn get_var<T: Into<String>, O: From<String>>(name: T) -> Result<O, String> {
|
||||
|
@ -158,8 +140,7 @@ pub fn loadenv() -> Result<Env, Box<dyn std::error::Error>> {
|
|||
return Err(format!("CONF_FILE is {}, which is not a file!", spath).into())
|
||||
}
|
||||
spath
|
||||
},
|
||||
version: VersionData::default()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
@ -66,13 +66,6 @@
|
|||
<tr>
|
||||
<td>
|
||||
<small>Made with Rust and <3</small>
|
||||
|
||||
<small style="display:block">
|
||||
Version
|
||||
<a href="https://git.blek.codes/blek/bfile/commit/{{ env.version.commit }}" target="_blank">
|
||||
{{ env!("CARGO_PKG_VERSION") }} ({{ env.version.branch -}}/{{- env.version.short_commit }})
|
||||
</a>
|
||||
</small>
|
||||
|
||||
<ul style='margin:10px 0'>
|
||||
<li>
|
||||
|
|
Loading…
Reference in New Issue