Browse Source

move configurables to config

master
Edward Shen 3 years ago
parent
commit
8304f4c645
Signed by: edward
GPG Key ID: F350507060ED6C90
  1. 4
      .gitignore
  2. 4
      Dockerfile
  3. 0
      config/endstat_conf.example.ron
  4. 0
      config/templates/index.html
  5. 4
      src/main.rs

4
.gitignore vendored

@ -1,5 +1,5 @@
target
**/*.rs.bk
*.ron
**/*.ron
.vscode/
!endstat_conf.example.ron
!**/endstat_conf.example.ron

4
Dockerfile

@ -19,9 +19,7 @@ RUN apt update && apt upgrade -y && apt install -y libssl1.1 ca-certificates
WORKDIR /app
COPY --from=builder /app/target/release/endstat /app
COPY ./endstat_conf.example.ron /app/endstat_conf.ron
COPY templates templates
COPY ./config /app/config
EXPOSE 8080
CMD ["/app/endstat"]

0
endstat_conf.example.ron → config/endstat_conf.example.ron

0
templates/index.html → config/templates/index.html

4
src/main.rs

@ -34,7 +34,7 @@ pub type State = Arc<RwLock<QueryResults>>;
fn main() {
System::run(move || {
let conf_file_loc =
var("ENDSTAT_CONF").unwrap_or_else(|_| String::from("./endstat_conf.ron"));
var("ENDSTAT_CONF").unwrap_or_else(|_| String::from("./config/endstat_conf.ron"));
let config = from_str::<Config>(
&read_to_string(&conf_file_loc).expect(&format!("finding {}", conf_file_loc)),
)
@ -54,7 +54,7 @@ fn main() {
let clone_state = Arc::clone(&state);
HttpServer::new(move || {
let tera = compile_templates!("./templates/**/*");
let tera = compile_templates!("./config/templates/**/*");
let state = Arc::clone(&state);
App::new()

Loading…
Cancel
Save