move configurables to config

master
Edward Shen 2019-05-02 01:51:27 -04:00
parent c4e8bc61b6
commit 8304f4c645
Signed by: edward
GPG Key ID: F350507060ED6C90
5 changed files with 5 additions and 7 deletions

4
.gitignore vendored
View File

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

View File

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

View File

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