Compare commits

..

1 Commits

Author SHA1 Message Date
130e7cc25e icarus_envy version bump
Some checks failed
Rust Build / Check (pull_request) Failing after 39s
Rust Build / Test Suite (pull_request) Failing after 52s
Rust Build / Rustfmt (pull_request) Successful in 29s
Rust Build / Clippy (pull_request) Failing after 39s
Rust Build / build (pull_request) Failing after 36s
2025-10-10 16:34:22 -04:00
9 changed files with 398 additions and 423 deletions

View File

@@ -10,14 +10,14 @@ jobs:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v5 uses: actions/checkout@v3
with: with:
fetch-depth: 0 # Important for git describe --tags fetch-depth: 0 # Important for git describe --tags
- name: Install Rust - name: Install Rust
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: 1.90.0 toolchain: 1.88.0
components: cargo components: cargo
- name: Extract Version from Cargo.toml - name: Extract Version from Cargo.toml

View File

@@ -15,10 +15,10 @@ jobs:
name: Check name: Check
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.90.0 toolchain: 1.88.0
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/icarus_models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/icarus_models_deploy_key
@@ -50,10 +50,10 @@ jobs:
--health-retries 5 --health-retries 5
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.90.0 toolchain: 1.88.0
# --- Add this step for explicit verification --- # --- Add this step for explicit verification ---
- name: Verify Docker Environment - name: Verify Docker Environment
run: | run: |
@@ -91,10 +91,10 @@ jobs:
name: Rustfmt name: Rustfmt
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.90.0 toolchain: 1.88.0
- run: rustup component add rustfmt - run: rustup component add rustfmt
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
@@ -110,10 +110,10 @@ jobs:
name: Clippy name: Clippy
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.90.0 toolchain: 1.88.0
- run: rustup component add clippy - run: rustup component add clippy
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
@@ -129,10 +129,10 @@ jobs:
name: build name: build
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.90.0 toolchain: 1.88.0
- run: | - run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/icarus_models_deploy_key echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/icarus_models_deploy_key

729
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,30 +1,30 @@
[package] [package]
name = "icarus_auth" name = "icarus_auth"
version = "0.6.0" version = "0.5.1"
edition = "2024" edition = "2024"
rust-version = "1.90" rust-version = "1.88"
[dependencies] [dependencies]
axum = { version = "0.8.6" } axum = { version = "0.8.4" }
serde = { version = "1.0.228", features = ["derive"] } serde = { version = "1.0.219", features = ["derive"] }
serde_json = { version = "1.0.145" } serde_json = { version = "1.0.140" }
tokio = { version = "1.47.1", features = ["rt-multi-thread"] } tokio = { version = "1.45.1", features = ["rt-multi-thread"] }
tracing-subscriber = { version = "0.3.20" } tracing-subscriber = { version = "0.3.19" }
tower = { version = "0.5.2", features = ["full"] } tower = { version = "0.5.2", features = ["full"] }
tower-http = { version = "0.6.6", features = ["cors"] } tower-http = { version = "0.6.6", features = ["cors"] }
hyper = { version = "1.7.0" } hyper = { version = "1.6.0" }
sqlx = { version = "0.8.6", features = ["postgres", "runtime-tokio-native-tls", "time", "uuid"] } sqlx = { version = "0.8.6", features = ["postgres", "runtime-tokio-native-tls", "time", "uuid"] }
uuid = { version = "1.18.1", features = ["v4", "serde"] } uuid = { version = "1.17.0", features = ["v4", "serde"] }
argon2 = { version = "0.5.3", features = ["std"] } # Use the latest 0.5.x version argon2 = { version = "0.5.3", features = ["std"] } # Use the latest 0.5.x version
rand = { version = "0.9.2" } rand = { version = "0.9.1" }
time = { version = "0.3.41", features = ["macros", "serde"] } time = { version = "0.3.41", features = ["macros", "serde"] }
josekit = { version = "0.10.3" } josekit = { version = "0.10.3" }
utoipa = { version = "5.4.0", features = ["axum_extras"] } utoipa = { version = "5.4.0", features = ["axum_extras"] }
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] } utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.7.0" } icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.5.6" }
icarus_envy = { git = "ssh://git@git.kundeng.us/phoenix/icarus_envy.git", tag = "v0.5.0" } icarus_envy = { git = "ssh://git@git.kundeng.us/phoenix/icarus_envy.git", tag = "v0.4.1-main-8f0d123db5-006" }
[dev-dependencies] [dev-dependencies]
http-body-util = { version = "0.1.3" } http-body-util = { version = "0.1.3" }
url = { version = "2.5.7" } url = { version = "2.5.4" }
once_cell = { version = "1.21.3" } # Useful for lazy initialization in tests/app setup once_cell = { version = "1.21.3" } # Useful for lazy initialization in tests/app setup

View File

@@ -1,7 +1,7 @@
# Stage 1: Build the application # Stage 1: Build the application
# Use a specific Rust version for reproducibility. Choose one that matches your development environment. # Use a specific Rust version for reproducibility. Choose one that matches your development environment.
# Using slim variant for smaller base image # Using slim variant for smaller base image
FROM rust:1.90 as builder FROM rust:1.88 as builder
# Set the working directory inside the container # Set the working directory inside the container
WORKDIR /usr/src/app WORKDIR /usr/src/app

View File

@@ -96,7 +96,7 @@ pub mod endpoint {
Ok(user) => { Ok(user) => {
if hashing::verify_password(&payload.password, user.password.clone()).unwrap() { if hashing::verify_password(&payload.password, user.password.clone()).unwrap() {
// Create token // Create token
let key = icarus_envy::environment::get_secret_key().await.value; let key = icarus_envy::environment::get_secret_key().await;
let (token_literal, duration) = let (token_literal, duration) =
token_stuff::create_token(&key, &user.id).unwrap(); token_stuff::create_token(&key, &user.id).unwrap();
@@ -155,7 +155,7 @@ pub mod endpoint {
match repo::service::valid_passphrase(&pool, &payload.passphrase).await { match repo::service::valid_passphrase(&pool, &payload.passphrase).await {
Ok((id, _passphrase, _date_created)) => { Ok((id, _passphrase, _date_created)) => {
let key = icarus_envy::environment::get_secret_key().await.value; let key = icarus_envy::environment::get_secret_key().await;
let (token_literal, duration) = let (token_literal, duration) =
token_stuff::create_service_token(&key, &id).unwrap(); token_stuff::create_service_token(&key, &id).unwrap();
@@ -207,7 +207,7 @@ pub mod endpoint {
axum::Json<response::refresh_token::Response>, axum::Json<response::refresh_token::Response>,
) { ) {
let mut response = response::refresh_token::Response::default(); let mut response = response::refresh_token::Response::default();
let key = icarus_envy::environment::get_secret_key().await.value; let key = icarus_envy::environment::get_secret_key().await;
if token_stuff::verify_token(&key, &payload.access_token) { if token_stuff::verify_token(&key, &payload.access_token) {
let token_type = token_stuff::get_token_type(&key, &payload.access_token).unwrap(); let token_type = token_stuff::get_token_type(&key, &payload.access_token).unwrap();

View File

@@ -16,7 +16,7 @@ pub mod db {
use crate::connection_settings; use crate::connection_settings;
pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> { pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> {
let database_url = icarus_envy::environment::get_db_url().await.value; let database_url = icarus_envy::environment::get_db_url().await;
println!("Database url: {database_url}"); println!("Database url: {database_url}");
PgPoolOptions::new() PgPoolOptions::new()

View File

@@ -66,22 +66,12 @@ mod init {
match std::env::var(icarus_envy::keys::APP_ENV).as_deref() { match std::env::var(icarus_envy::keys::APP_ENV).as_deref() {
Ok("production") => { Ok("production") => {
let allowed_origins_env = icarus_envy::environment::get_allowed_origins().await; let allowed_origins_env = icarus_envy::environment::get_allowed_origins().await;
match icarus_envy::utility::delimitize(&allowed_origins_env) { let allowed_origins: Vec<axum::http::HeaderValue> = allowed_origins_env
Ok(alwd) => { .split(",")
let allowed_origins: Vec<axum::http::HeaderValue> = alwd
.into_iter()
.map(|s| s.parse::<axum::http::HeaderValue>().unwrap()) .map(|s| s.parse::<axum::http::HeaderValue>().unwrap())
.collect(); .collect();
cors.allow_origin(allowed_origins) cors.allow_origin(allowed_origins)
} }
Err(err) => {
eprintln!(
"Could not parse out allowed origins from env: Error: {err:?}"
);
std::process::exit(-1);
}
}
}
_ => { _ => {
// Development (default): Allow localhost origins // Development (default): Allow localhost origins
cors.allow_origin(vec![ cors.allow_origin(vec![
@@ -158,7 +148,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.value; let tm_db_url = icarus_envy::environment::get_db_url().await;
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
} }
@@ -171,7 +161,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.value; let db_url = icarus_envy::environment::get_db_url().await;
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
} }
@@ -198,7 +188,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.value; let database_url = icarus_envy::environment::get_db_url().await;
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" {
@@ -501,7 +491,7 @@ mod tests {
let app = init::routes().await.layer(axum::Extension(pool)); let app = init::routes().await.layer(axum::Extension(pool));
let id = uuid::Uuid::parse_str("22f9c775-cce9-457a-a147-9dafbb801f61").unwrap(); let id = uuid::Uuid::parse_str("22f9c775-cce9-457a-a147-9dafbb801f61").unwrap();
let key = icarus_envy::environment::get_secret_key().await.value; let key = icarus_envy::environment::get_secret_key().await;
match icarus_auth::token_stuff::create_service_token(&key, &id) { match icarus_auth::token_stuff::create_service_token(&key, &id) {
Ok((token, _expire)) => { Ok((token, _expire)) => {

View File

@@ -124,9 +124,7 @@ mod tests {
#[test] #[test]
fn test_tokenize() { fn test_tokenize() {
let rt = tokio::runtime::Runtime::new().unwrap(); let rt = tokio::runtime::Runtime::new().unwrap();
let special_key = rt let special_key = rt.block_on(icarus_envy::environment::get_secret_key());
.block_on(icarus_envy::environment::get_secret_key())
.value;
let id = uuid::Uuid::new_v4(); let id = uuid::Uuid::new_v4();
match create_token(&special_key, &id) { match create_token(&special_key, &id) {
Ok((token, _duration)) => { Ok((token, _duration)) => {