From 8304f4c645c8b02e93b20067c4f569aa2481df12 Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Thu, 2 May 2019 01:51:27 -0400 Subject: [PATCH] move configurables to config --- .gitignore | 4 ++-- Dockerfile | 4 +--- endstat_conf.example.ron => config/endstat_conf.example.ron | 0 {templates => config/templates}/index.html | 0 src/main.rs | 4 ++-- 5 files changed, 5 insertions(+), 7 deletions(-) rename endstat_conf.example.ron => config/endstat_conf.example.ron (100%) rename {templates => config/templates}/index.html (100%) diff --git a/.gitignore b/.gitignore index 7149c85..0c0c282 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ target **/*.rs.bk -*.ron +**/*.ron .vscode/ -!endstat_conf.example.ron +!**/endstat_conf.example.ron diff --git a/Dockerfile b/Dockerfile index 48c9b49..4ba4f0a 100644 --- a/Dockerfile +++ b/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"] diff --git a/endstat_conf.example.ron b/config/endstat_conf.example.ron similarity index 100% rename from endstat_conf.example.ron rename to config/endstat_conf.example.ron diff --git a/templates/index.html b/config/templates/index.html similarity index 100% rename from templates/index.html rename to config/templates/index.html diff --git a/src/main.rs b/src/main.rs index 94154ab..c6aec79 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,7 +34,7 @@ pub type State = Arc>; 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::( &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()