diff --git a/.env.sample b/.env.sample index f53ca9a..8be2df0 100644 --- a/.env.sample +++ b/.env.sample @@ -1,8 +1,8 @@ -APP_ENV=development +APP_ENV=production BACKEND_PORT=8000 FRONTEND_URL=http://localhost:4200 RUST_LOG=debug -ALLOWED_ORIGINS=https://soaricarus.com,https://www.soaricarus.com +ALLOWED_ORIGINS=https://soaricarus.com,https://www.soaricarus.com,http://localhost:8000,http://127.0.0.1:8000 SECRET_MAIN_KEY=refero34o8rfhfjn983thf39fhc943rf923n3h ROOT_DIRECTORY=/home/icarus/mydata POSTGRES_MAIN_USER=icarus diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 152abea..be9b246 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -2,9 +2,9 @@ name: Rust CI on: push: - branches: [ "v0.2" ] + branches: [ "main" ] pull_request: - branches: [ "v0.2" ] + branches: [ "main" ] jobs: build: @@ -25,7 +25,7 @@ jobs: --health-retries 5 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Install Rust 1.90.0 uses: actions-rs/toolchain@v1 @@ -69,7 +69,7 @@ jobs: ROOT_DIRECTORY: "/tmp" DATABASE_URL: "postgres://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@localhost:5432/${{ secrets.POSTGRES_DB }}" run: | - cat .env.sample | head -1 > .env + cat .env.sample | head -6 > .env cargo test --verbose -- - name: Run clippy diff --git a/README.md b/README.md index 58298aa..a76440a 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ Web API for the Icarus project. +### Requires +`icarus_auth` +v0.6.0 +`songparser` +v0.4.1 + ## Getting Started Quickest way to get started is with docker. Make sure `icarus_auth` and `songparser` repositories are located in the root of the parent directory. Check the respective repositories to ensure they diff --git a/src/callers/song.rs b/src/callers/song.rs index 20e3cb8..b6f6e3c 100644 --- a/src/callers/song.rs +++ b/src/callers/song.rs @@ -869,8 +869,6 @@ mod song_queue { pub mod endpoint { use axum::{Json, http::StatusCode, response::IntoResponse}; - use std::io::Write; - use crate::callers::song::song_queue; /// Endpoint to queue a song. Starts the process and places the song in a queue @@ -907,11 +905,6 @@ pub mod endpoint { data.len() ); - // TODO: Remove this - // Save the file to disk - let mut file = std::fs::File::create(&file_name).unwrap(); - file.write_all(&data).unwrap(); - let raw_data: Vec = data.to_vec(); let queue_repo = song_queue::insert( &pool, diff --git a/src/main.rs b/src/main.rs index a373fb0..43b7d88 100644 --- a/src/main.rs +++ b/src/main.rs @@ -335,7 +335,7 @@ mod tests { pub const LIMIT: usize = 6; pub async fn get_pool() -> Result { - let tm_db_url = icarus_envy::environment::get_db_url().await; + let tm_db_url = icarus_envy::environment::get_db_url().await.value; let tm_options = sqlx::postgres::PgConnectOptions::from_str(&tm_db_url).unwrap(); sqlx::PgPool::connect_with(tm_options).await } @@ -348,7 +348,7 @@ mod tests { } pub async fn connect_to_db(db_name: &str) -> Result { - let db_url = icarus_envy::environment::get_db_url().await; + let db_url = icarus_envy::environment::get_db_url().await.value; let options = sqlx::postgres::PgConnectOptions::from_str(&db_url)?.database(db_name); sqlx::PgPool::connect_with(options).await } @@ -375,7 +375,7 @@ mod tests { } pub async fn get_database_name() -> Result> { - let database_url = icarus_envy::environment::get_db_url().await; + let database_url = icarus_envy::environment::get_db_url().await.value; let parsed_url = url::Url::parse(&database_url)?; if parsed_url.scheme() == "postgres" || parsed_url.scheme() == "postgresql" { @@ -425,7 +425,7 @@ mod tests { pub const TEST_USER_ID: uuid::Uuid = uuid::uuid!("cc938368-615a-4694-b2ca-6e122fa31c52"); pub async fn test_token() -> Result { - let key: String = icarus_envy::environment::get_secret_main_key().await; + let key: String = icarus_envy::environment::get_secret_main_key().await.value; let (message, issuer, audience) = token_fields(); let token_resource = icarus_models::token::TokenResource { @@ -2384,8 +2384,8 @@ mod tests { ..Default::default() }; - match song.to_data() { - Ok(song_data) => match coverart.to_data() { + match icarus_models::song::io::to_data(&song) { + Ok(song_data) => match icarus_models::coverart::io::to_data(&coverart) { Ok(coverart_data) => Ok((song_data, coverart_data)), Err(err) => Err(err), },