Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Nov 5, 2023
1 parent 7a5bed6 commit 0e8f426
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ cd Navigatum
> You can skip all the parts if you run `docker compose up --build` in the root of the repository
> and then open [http://localhost:3000](http://localhost:3000) in your browser.
> This will run the server, the data processing and the webclient in docker containers.
>
> To be able to run the map
### Data Processing

Expand Down
19 changes: 10 additions & 9 deletions server/calendar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ mod utils;
use actix_cors::Cors;
use actix_web::{get, middleware, web, App, HttpResponse, HttpServer};
use actix_web_prom::PrometheusMetricsBuilder;
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
use log::info;
use std::collections::HashMap;
use std::error::Error;
use structured_logger::async_json::new_writer;
use structured_logger::Builder;

const MAX_JSON_PAYLOAD: usize = 1024 * 1024; // 1 MB

Expand All @@ -21,26 +26,22 @@ async fn health_status_handler() -> HttpResponse {
.body(format!("healthy\nsource_code: {github_link}"))
}

use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
use log::debug;
use structured_logger::async_json::new_writer;
use structured_logger::Builder;

pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!("migrations");

fn apply_db_migrations() {
fn apply_db_migrations() -> Result<(),Box<dyn Error + Send + Sync>> {
info!("Applying database migrations");
let con = &mut utils::establish_connection();
con.run_pending_migrations(MIGRATIONS)
.expect("Migrations could not be applied");
con.run_pending_migrations(MIGRATIONS)?;
info!("database migrations applied");
Ok(())
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
Builder::with_level("info")
.with_target_writer("*", new_writer(tokio::io::stdout()))
.init();
apply_db_migrations();
apply_db_migrations()?;

// metrics
let labels = HashMap::from([(
Expand Down

0 comments on commit 0e8f426

Please sign in to comment.