diff --git a/.env.docker.sample b/.env.docker.sample index a909ec8..62bc552 100644 --- a/.env.docker.sample +++ b/.env.docker.sample @@ -10,4 +10,5 @@ TWILIO_AUTH_SID=9M438C93R943U4329MCU43C34U TWILIO_SERVICE_SID=9M4J3X8439U398NUVT3342MC349C348T TWILIO_AUTH_TOKEN="MA08HJp9tYtkfs72m8JIIROofRVm74oR0ixEYBHGYpB9" TWILIO_PHONE_NUMBER=+10123456789 -ALLOWED_ORIGINS="http://textsender.com" +ALLOWED_ORIGINS="http://textsender.com,http://localhost:5173,http://localhost:9080,http://localhost:9081" +APP_ENV=production diff --git a/.env.local.sample b/.env.local.sample index 339c1d2..492efa4 100644 --- a/.env.local.sample +++ b/.env.local.sample @@ -10,4 +10,5 @@ TWILIO_AUTH_SID=9M438C93R943U4329MCU43C34U TWILIO_SERVICE_SID=9M4J3X8439U398NUVT3342MC349C348T TWILIO_AUTH_TOKEN="MA08HJp9tYtkfs72m8JIIROofRVm74oR0ixEYBHGYpB9" TWILIO_PHONE_NUMBER=+10123456789 -ALLOWED_ORIGINS="http://textsender.com" +ALLOWED_ORIGINS="http://textsender.com,http://localhost:5173,http://localhost:9080,http://localhost:9081" +APP_ENV=production diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index 40dfaac..1d3da27 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -14,10 +14,10 @@ jobs: name: Check runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 - uses: Swatinem/rust-cache@v2 - run: | mkdir -p ~/.ssh @@ -34,10 +34,10 @@ jobs: name: Rustfmt runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 - run: rustup component add rustfmt - uses: Swatinem/rust-cache@v2 - run: | @@ -54,10 +54,10 @@ jobs: name: Clippy runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 - run: rustup component add clippy - uses: Swatinem/rust-cache@v2 - run: | diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 7f58e3f..cc80642 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -32,10 +32,10 @@ jobs: --health-retries 5 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 # --- Add this step for explicit verification --- - name: Verify Docker Environment run: | @@ -74,10 +74,10 @@ jobs: name: Rustfmt runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 - run: rustup component add rustfmt - uses: Swatinem/rust-cache@v2 - run: | diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index bdb4abd..680e84d 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -15,10 +15,10 @@ jobs: name: Check runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 - uses: Swatinem/rust-cache@v2 - run: | mkdir -p ~/.ssh @@ -52,10 +52,10 @@ jobs: --health-retries 5 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 # --- Add this step for explicit verification --- - name: Verify Docker Environment run: | @@ -94,10 +94,10 @@ jobs: name: Rustfmt runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 - run: rustup component add rustfmt - uses: Swatinem/rust-cache@v2 - run: | @@ -114,10 +114,10 @@ jobs: name: Clippy runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 - run: rustup component add clippy - uses: Swatinem/rust-cache@v2 - run: | @@ -134,10 +134,10 @@ jobs: name: build runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 - uses: Swatinem/rust-cache@v2 - run: | mkdir -p ~/.ssh diff --git a/Cargo.lock b/Cargo.lock index 017c00b..4165ab3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -228,9 +228,9 @@ checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593" [[package]] name = "cc" -version = "1.2.65" +version = "1.2.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e228eec9be7c17ccb640b59b36a5cd805ea2a564a4c5e162c2f659fea30d3b96" +checksum = "f5d6cac793997bd970000024b2934968efe83b382de4fdcf4fcb46b6ee4ad996" dependencies = [ "find-msvc-tools", "jobserver", @@ -403,18 +403,18 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +checksum = "803d13fb3b09d88be9f4dbc29062c66b19bf7170867ceb746d2a8689bf6c7a26" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" [[package]] name = "crypto-bigint" @@ -873,18 +873,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "libc", - "r-efi 5.3.0", - "wasip2", -] - [[package]] name = "getrandom" version = "0.4.3" @@ -894,7 +882,7 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "r-efi 6.0.0", + "r-efi", "rand_core 0.10.1", "wasm-bindgen", ] @@ -1307,11 +1295,11 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" dependencies = [ - "getrandom 0.3.4", + "getrandom 0.4.3", "libc", ] @@ -1405,9 +1393,9 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libsqlite3-sys" -version = "0.30.1" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" +checksum = "b1f111c8c41e7c61a49cd34e44c7619462967221a6443b0ec299e0ac30cfb9b1" dependencies = [ "pkg-config", "vcpkg", @@ -1550,9 +1538,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c863e9ab5e7bf9c99ba75e1050f1e4d624ae87ed3532d6238ffbdc7b585dbbe6" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" dependencies = [ "num-integer", "num-traits", @@ -1878,12 +1866,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - [[package]] name = "r-efi" version = "6.0.0" @@ -2213,9 +2195,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" [[package]] name = "ryu" @@ -2708,8 +2690,8 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "swoosh" -version = "0.5.1" -source = "git+ssh://git@git.kundeng.us/phoenix/swoosh.git?tag=v0.5.1#d36483e6f846efd1b0b9bec6aa98194a5494669f" +version = "0.5.2" +source = "git+ssh://git@git.kundeng.us/phoenix/swoosh.git?tag=v0.5.2#50e4b209f521d8985d73a33b4a8f1db69334100a" dependencies = [ "base64-ng", "reqwest", @@ -2786,7 +2768,7 @@ dependencies = [ [[package]] name = "textsender_api" -version = "0.2.2" +version = "0.2.3" dependencies = [ "axum", "axum-extra", @@ -2810,8 +2792,8 @@ dependencies = [ [[package]] name = "textsender_models" -version = "0.5.0" -source = "git+ssh://git@git.kundeng.us/phoenix/textsender_models.git?tag=v0.5.0#137398405fbc61acd352530f8cbfd4d98e648e95" +version = "0.5.1" +source = "git+ssh://git@git.kundeng.us/phoenix/textsender_models.git?tag=v0.5.1#151eeaacf64e255bde56a48df03f4c46ec77c235" dependencies = [ "const_format", "dotenvy", @@ -3268,15 +3250,6 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" -[[package]] -name = "wasip2" -version = "1.0.4+wasi-0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" -dependencies = [ - "wit-bindgen", -] - [[package]] name = "wasm-bindgen" version = "0.2.126" @@ -3506,12 +3479,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "wit-bindgen" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" - [[package]] name = "writeable" version = "0.6.3" @@ -3543,18 +3510,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.52" +version = "0.8.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f" +checksum = "75726053136156d419e285b9b7eddaaea9e3fea6ce32eed44a89901f0bd98de1" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.52" +version = "0.8.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930" +checksum = "4714fd92cf900833d49538023a9b3915155210801d1c1169eba513b2addefd71" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 9d91aca..c3f8006 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "textsender_api" -version = "0.2.2" +version = "0.2.3" edition = "2024" -rust-version = "1.96" +rust-version = "1.96.1" [dependencies] axum = { version = "0.8.9", features = ["multipart"] } @@ -18,8 +18,8 @@ time = { version = "0.3.53", features = ["formatting", "macros", "parsing", "ser jsonwebtoken = { version = "10.4.0", features = ["rust_crypto"] } utoipa = { version = "5.5.0", features = ["axum_extras"] } utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] } -textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.0" } -swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.5.1" } +textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.1" } +swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.5.2" } [dev-dependencies] tower = { version = "0.5.3", features = ["full"] } diff --git a/Dockerfile b/Dockerfile index 16962b1..3a86044 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Build the application -FROM rust:1.96 as builder +FROM rust:1.96.1 as builder # Set the working directory inside the container WORKDIR /usr/src/app diff --git a/tests/test.rs b/tests/test.rs index 69289d1..4a63a09 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -6,9 +6,7 @@ mod db_mgr { pub const LIMIT: usize = 6; pub async fn get_pool() -> Result { - let tm_db_url = textsender_models::envy::environment::get_db_url() - .await - .value; + let tm_db_url = textsender_models::envy::environment::get_db_url().value; let tm_options = sqlx::postgres::PgConnectOptions::from_str(&tm_db_url).unwrap(); sqlx::PgPool::connect_with(tm_options).await } @@ -20,9 +18,7 @@ mod db_mgr { } pub async fn connect_to_db(db_name: &str) -> Result { - let db_url = textsender_models::envy::environment::get_db_url() - .await - .value; + let db_url = textsender_models::envy::environment::get_db_url().value; let options = sqlx::postgres::PgConnectOptions::from_str(&db_url)?.database(db_name); sqlx::PgPool::connect_with(options).await } @@ -81,9 +77,7 @@ mod db_mgr { } pub async fn get_database_name() -> Result> { - let database_url = textsender_models::envy::environment::get_db_url() - .await - .value; + let database_url = textsender_models::envy::environment::get_db_url().value; let parsed_url = url::Url::parse(&database_url)?; if parsed_url.scheme() == "postgres" || parsed_url.scheme() == "postgresql" { @@ -191,9 +185,7 @@ pub fn test_mer_response() -> serde_json::Value { } pub async fn test_token() -> Result { - let key: String = textsender_models::envy::environment::get_secret_main_key() - .await - .value; + let key: String = textsender_models::envy::environment::get_secret_main_key().value; let (message, issuer, audience) = token_fields(); let token_resource = textsender_models::token::TokenResource { @@ -203,7 +195,7 @@ pub async fn test_token() -> Result { user_id: TEST_USER_ID, }; - match textsender_models::token::create_token(&key, &token_resource, time::Duration::hours(1)) { + match textsender_models::token::create_token(&key, token_resource, time::Duration::hours(1)) { Ok(access_token) => Ok(access_token.access_token), Err(err) => Err(err), }