remove the commit display feature as it is more hassle than benefit
This commit is contained in:
parent
3ba86697b7
commit
7a0b197dc6
|
@ -8,7 +8,6 @@ services:
|
||||||
bfile:
|
bfile:
|
||||||
volumes:
|
volumes:
|
||||||
- './filed:/opt/code'
|
- './filed:/opt/code'
|
||||||
- './.git:/opt/code/.git:ro' # for fetching the latest commit version
|
|
||||||
- '/opt/code/target'
|
- '/opt/code/target'
|
||||||
- './volatile/files:/opt/user_uploads'
|
- './volatile/files:/opt/user_uploads'
|
||||||
caddy:
|
caddy:
|
||||||
|
|
|
@ -4,8 +4,6 @@ FROM rust as builder
|
||||||
WORKDIR /opt/code
|
WORKDIR /opt/code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN apt install -y git
|
|
||||||
|
|
||||||
# No build is done during this step
|
# No build is done during this step
|
||||||
# since the directory will be mounted anyways
|
# since the directory will be mounted anyways
|
||||||
# to the dev's machine.
|
# to the dev's machine.
|
||||||
|
|
|
@ -7,8 +7,6 @@ use std::{env::var, net::SocketAddr, path::Path, fs};
|
||||||
|
|
||||||
use compile_time_run::run_command_str;
|
use compile_time_run::run_command_str;
|
||||||
|
|
||||||
const LAST_COMMIT: &'static str = run_command_str!("git", "--no-pager", "log", "--pretty=format:%H", "-1");
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Redis {
|
pub struct Redis {
|
||||||
pub pass: String,
|
pub pass: String,
|
||||||
|
@ -24,8 +22,7 @@ pub struct Env {
|
||||||
pub redis: Redis,
|
pub redis: Redis,
|
||||||
pub filedir: String,
|
pub filedir: String,
|
||||||
pub instanceurl: String,
|
pub instanceurl: String,
|
||||||
pub uploadspath: String,
|
pub uploadspath: String
|
||||||
pub last_commit: &'static str
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_var<T: Into<String>, O: From<String>>(name: T) -> Result<O, String> {
|
fn get_var<T: Into<String>, O: From<String>>(name: T) -> Result<O, String> {
|
||||||
|
@ -60,8 +57,7 @@ pub fn loadenv() -> Result<Env, Box<dyn std::error::Error>> {
|
||||||
spath
|
spath
|
||||||
},
|
},
|
||||||
instanceurl: get_var("INSTANCE_URL")?,
|
instanceurl: get_var("INSTANCE_URL")?,
|
||||||
uploadspath: get_var("UPLOADS_PATH")?,
|
uploadspath: get_var("UPLOADS_PATH")?
|
||||||
last_commit: LAST_COMMIT
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -70,8 +66,4 @@ impl Env {
|
||||||
pub fn usercontent_dir(self: &Self) -> Box<&Path> {
|
pub fn usercontent_dir(self: &Self) -> Box<&Path> {
|
||||||
Box::new(Path::new(&self.filedir))
|
Box::new(Path::new(&self.filedir))
|
||||||
}
|
}
|
||||||
pub fn shortcommit(self: &Self) -> String {
|
|
||||||
let commit = self.last_commit.to_string().clone();
|
|
||||||
commit.chars().take(6).collect()
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
use std::env::current_dir;
|
use std::env::current_dir;
|
||||||
|
|
||||||
|
use static_dir::static_dir;
|
||||||
use warp::{Filter, reply::Reply, reject::Rejection};
|
use warp::{Filter, reply::Reply, reject::Rejection};
|
||||||
|
|
||||||
use crate::{env::Env, files::lookup::FileManager};
|
use crate::{env::Env, files::lookup::FileManager};
|
||||||
|
@ -23,6 +24,7 @@ pub fn routes(state: SharedState) -> impl Filter<Extract = impl Reply, Error = R
|
||||||
pages::get_routes(state.clone())
|
pages::get_routes(state.clone())
|
||||||
.or(forms::get_routes(state.clone()))
|
.or(forms::get_routes(state.clone()))
|
||||||
.or(api::get_routes(state))
|
.or(api::get_routes(state))
|
||||||
|
.or(static_dir!("static"))
|
||||||
.or(warp::fs::dir(staticpath.to_string()))
|
.or(warp::fs::dir(staticpath.to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
bleK! File {{ env.shortcommit() }}
|
Made with Rust
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
Released under GPLv3
|
Released under GPLv3
|
||||||
|
|
Loading…
Reference in New Issue