diff --git a/docker-compose.yml b/docker-compose.yml index cce084f6..d4daa759 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,22 @@ services: web: - build: . + build: { context: ".", args: {SKIP_CHECK: 1}} ports: - "8080:8080" volumes: - .:/var/www depends_on: - - postgres + - db environment: - DATABASE_URL: postgres://postgres:secret@postgres - postgres: + DATABASE_URL: ${DB:-postgres}://root:secret@db/sqlpage + db: # The DB environment variable can be set to "mariadb" or "postgres" to test the code with different databases ports: - "5432:5432" - image: postgres + - "3306:3306" + image: ${DB:-postgres} environment: - POSTGRES_PASSWORD: secret \ No newline at end of file + POSTGRES_USER: root + POSTGRES_DB: sqlpage + POSTGRES_PASSWORD: secret + MYSQL_ROOT_PASSWORD: secret + MYSQL_DATABASE: sqlpage \ No newline at end of file diff --git a/src/webserver/database.rs b/src/webserver/database.rs index 7e943b3a..3f3dce2d 100644 --- a/src/webserver/database.rs +++ b/src/webserver/database.rs @@ -174,6 +174,11 @@ pub async fn init_database(database_url: &str) -> anyhow::Result { log::LevelFilter::Warn, std::time::Duration::from_millis(250), ); + log::debug!( + "Connecting to a {:?} database on {}", + connect_options.kind(), + database_url + ); let connection = AnyPool::connect_with(connect_options) .await .with_context(|| "Failed to connect to database")?;