Version fix #193

Merged
kdeng00 merged 11 commits from fix_version into main 2025-10-14 22:02:26 -04:00
5 changed files with 16 additions and 19 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
APP_ENV=development APP_ENV=production
BACKEND_PORT=8000 BACKEND_PORT=8000
FRONTEND_URL=http://localhost:4200 FRONTEND_URL=http://localhost:4200
RUST_LOG=debug 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 SECRET_MAIN_KEY=refero34o8rfhfjn983thf39fhc943rf923n3h
ROOT_DIRECTORY=/home/icarus/mydata ROOT_DIRECTORY=/home/icarus/mydata
POSTGRES_MAIN_USER=icarus POSTGRES_MAIN_USER=icarus
+4 -4
View File
@@ -2,9 +2,9 @@ name: Rust CI
on: on:
push: push:
branches: [ "v0.2" ] branches: [ "main" ]
pull_request: pull_request:
branches: [ "v0.2" ] branches: [ "main" ]
jobs: jobs:
build: build:
@@ -25,7 +25,7 @@ jobs:
--health-retries 5 --health-retries 5
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Install Rust 1.90.0 - name: Install Rust 1.90.0
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
@@ -69,7 +69,7 @@ jobs:
ROOT_DIRECTORY: "/tmp" ROOT_DIRECTORY: "/tmp"
DATABASE_URL: "postgres://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@localhost:5432/${{ secrets.POSTGRES_DB }}" DATABASE_URL: "postgres://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@localhost:5432/${{ secrets.POSTGRES_DB }}"
run: | run: |
cat .env.sample | head -1 > .env cat .env.sample | head -6 > .env
cargo test --verbose -- cargo test --verbose --
- name: Run clippy - name: Run clippy
+4
View File
@@ -2,6 +2,10 @@
Web API for the Icarus project. Web API for the Icarus project.
### Requires
`icarus_auth` +v0.6.0
`songparser` +v0.4.1
## Getting Started ## Getting Started
Quickest way to get started is with docker. Make sure `icarus_auth` and `songparser` repositories 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 are located in the root of the parent directory. Check the respective repositories to ensure they
-7
View File
@@ -869,8 +869,6 @@ mod song_queue {
pub mod endpoint { pub mod endpoint {
use axum::{Json, http::StatusCode, response::IntoResponse}; use axum::{Json, http::StatusCode, response::IntoResponse};
use std::io::Write;
use crate::callers::song::song_queue; use crate::callers::song::song_queue;
/// Endpoint to queue a song. Starts the process and places the song in a 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() 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<u8> = data.to_vec(); let raw_data: Vec<u8> = data.to_vec();
let queue_repo = song_queue::insert( let queue_repo = song_queue::insert(
&pool, &pool,
+6 -6
View File
@@ -335,7 +335,7 @@ mod tests {
pub const LIMIT: usize = 6; pub const LIMIT: usize = 6;
pub async fn get_pool() -> Result<sqlx::PgPool, sqlx::Error> { pub async fn get_pool() -> Result<sqlx::PgPool, sqlx::Error> {
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(); let tm_options = sqlx::postgres::PgConnectOptions::from_str(&tm_db_url).unwrap();
sqlx::PgPool::connect_with(tm_options).await sqlx::PgPool::connect_with(tm_options).await
} }
@@ -348,7 +348,7 @@ mod tests {
} }
pub async fn connect_to_db(db_name: &str) -> Result<sqlx::PgPool, sqlx::Error> { pub async fn connect_to_db(db_name: &str) -> Result<sqlx::PgPool, sqlx::Error> {
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); let options = sqlx::postgres::PgConnectOptions::from_str(&db_url)?.database(db_name);
sqlx::PgPool::connect_with(options).await sqlx::PgPool::connect_with(options).await
} }
@@ -375,7 +375,7 @@ mod tests {
} }
pub async fn get_database_name() -> Result<String, Box<dyn std::error::Error>> { pub async fn get_database_name() -> Result<String, Box<dyn std::error::Error>> {
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)?; let parsed_url = url::Url::parse(&database_url)?;
if parsed_url.scheme() == "postgres" || parsed_url.scheme() == "postgresql" { 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 const TEST_USER_ID: uuid::Uuid = uuid::uuid!("cc938368-615a-4694-b2ca-6e122fa31c52");
pub async fn test_token() -> Result<String, josekit::JoseError> { pub async fn test_token() -> Result<String, josekit::JoseError> {
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 (message, issuer, audience) = token_fields();
let token_resource = icarus_models::token::TokenResource { let token_resource = icarus_models::token::TokenResource {
@@ -2384,8 +2384,8 @@ mod tests {
..Default::default() ..Default::default()
}; };
match song.to_data() { match icarus_models::song::io::to_data(&song) {
Ok(song_data) => match coverart.to_data() { Ok(song_data) => match icarus_models::coverart::io::to_data(&coverart) {
Ok(coverart_data) => Ok((song_data, coverart_data)), Ok(coverart_data) => Ok((song_data, coverart_data)),
Err(err) => Err(err), Err(err) => Err(err),
}, },