diff --git a/axum1-cli/src/main.rs b/axum1-cli/src/main.rs index 84cd2f6..03a8f58 100644 --- a/axum1-cli/src/main.rs +++ b/axum1-cli/src/main.rs @@ -26,6 +26,8 @@ enum Commands { Resume, /// Pause the indexing Pause, + /// Reload config + ReloadConfig, } #[tokio::main] @@ -45,6 +47,7 @@ async fn main() -> Result<(), Box> { Some(Commands::Index) => "index", Some(Commands::Resume) => "resume", Some(Commands::Pause) => "pause", + Some(Commands::ReloadConfig) => "reload_config", _ => "todo", }; diff --git a/axum1/Cargo.lock b/axum1/Cargo.lock index 6e23bd9..e5ada61 100644 --- a/axum1/Cargo.lock +++ b/axum1/Cargo.lock @@ -24,7 +24,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", - "getrandom", "once_cell", "version_check", "zerocopy", @@ -62,9 +61,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "arc-swap" @@ -84,6 +83,12 @@ dependencies = [ "password-hash", ] +[[package]] +name = "arraydeque" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" + [[package]] name = "arrayref" version = "0.3.7" @@ -98,9 +103,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "async-stream" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", @@ -109,13 +114,13 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] @@ -126,7 +131,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] @@ -152,9 +157,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "axum" -version = "0.7.5" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", "axum-core", @@ -179,7 +184,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper 1.0.1", "tokio", - "tower", + "tower 0.5.1", "tower-layer", "tower-service", "tracing", @@ -187,9 +192,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" dependencies = [ "async-trait", "bytes", @@ -200,7 +205,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.1", "tower-layer", "tower-service", "tracing", @@ -208,38 +213,38 @@ dependencies = [ [[package]] name = "axum-extra" -version = "0.9.3" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0be6ea09c9b96cb5076af0de2e383bd2bc0c18f827cf1967bdd353e0b910d733" +checksum = "c794b30c904f0a1c2fb7740f7df7f7972dfaa14ef6f57cb6178dc63e5dca2f04" dependencies = [ "axum", "axum-core", "bytes", "cookie", + "fastrand", "futures-util", "http 1.1.0", "http-body 1.0.1", "http-body-util", "mime", + "multer", "pin-project-lite", "serde", "serde_html_form", - "tower", + "tower 0.5.1", "tower-layer", "tower-service", - "tracing", ] [[package]] name = "axum-macros" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00c055ee2d014ae5981ce1016374e8213682aa14d9bf40e48ab48b5f3ef20eaa" +checksum = "57d123550fa8d071b7255cb0cc04dc302baa6c8c4a79f55701552684d8399bce" dependencies = [ - "heck", "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] @@ -259,8 +264,8 @@ dependencies = [ "once_cell", "pin-project", "tokio", - "tower", - "tower-http", + "tower 0.4.13", + "tower-http 0.5.2", ] [[package]] @@ -278,7 +283,7 @@ dependencies = [ "blake3", "chrono", "config", - "dotenv", + "dotenvy", "futures", "log", "meilisearch-sdk", @@ -288,19 +293,19 @@ dependencies = [ "pin-project", "rand", "regex", - "reqwest 0.12.5", + "reqwest 0.12.9", "secrecy", "sentry", "sentry-tracing", "serde", "serde_json", "sqlx", - "thiserror", + "thiserror 2.0.3", "time", "tokio", "tokio-util", - "tower", - "tower-http", + "tower 0.5.1", + "tower-http 0.6.2", "tower-sessions", "tower-sessions-redis-store", "tracing", @@ -350,10 +355,12 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bigdecimal" -version = "0.3.1" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" +checksum = "8f850665a0385e070b64c38d2354e6c104c8479c59868d1e48a0c13ee2c7a1c1" dependencies = [ + "autocfg", + "libm", "num-bigint", "num-integer", "num-traits", @@ -460,16 +467,24 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "config" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7328b20597b53c2454f0b1919720c25c7339051c02b72b7e05409e00b14132be" +checksum = "68578f196d2a33ff61b27fae256c3164f65e36382648e30666dde05b8cc9dfdf" dependencies = [ "async-trait", "convert_case", "json5", - "lazy_static", "nom", "pathdiff", "ron", @@ -477,7 +492,7 @@ dependencies = [ "serde", "serde_json", "toml", - "yaml-rust", + "yaml-rust2", ] [[package]] @@ -629,6 +644,41 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "debugid" version = "0.8.0" @@ -672,6 +722,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "dlv-list" version = "0.5.2" @@ -681,12 +742,6 @@ dependencies = [ "const-random", ] -[[package]] -name = "dotenv" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" - [[package]] name = "dotenvy" version = "0.15.7" @@ -740,9 +795,14 @@ dependencies = [ [[package]] name = "event-listener" -version = "2.5.3" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] [[package]] name = "fastrand" @@ -840,9 +900,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -855,9 +915,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -865,15 +925,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -893,38 +953,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1005,12 +1065,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" - [[package]] name = "hashbrown" version = "0.14.5" @@ -1027,18 +1081,24 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.14.5", + "hashbrown", ] [[package]] -name = "heck" -version = "0.4.1" +name = "hashlink" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ - "unicode-segmentation", + "hashbrown", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.3.9" @@ -1271,7 +1331,7 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", - "tower", + "tower 0.4.13", "tower-service", "tracing", ] @@ -1300,15 +1360,129 @@ dependencies = [ ] [[package]] -name = "idna" -version = "0.4.0" +name = "icu_collections" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", ] +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.5.0" @@ -1320,10 +1494,25 @@ dependencies = [ ] [[package]] -name = "if_chain" -version = "1.0.2" +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] [[package]] name = "indexmap" @@ -1332,7 +1521,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown", ] [[package]] @@ -1412,27 +1601,27 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libsqlite3-sys" -version = "0.27.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "cc", "pkg-config", "vcpkg", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "lock_api" version = "0.4.12" @@ -1477,22 +1666,22 @@ dependencies = [ [[package]] name = "meilisearch-index-setting-macro" -version = "0.27.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54abc57ee746d0f8c2a40ca900af67cbf022b0e4be3d2ff806939322b5f3bc39" +checksum = "056e8c0652af81cc6525e0d9c0e1037ea7bcd77955dcd4aef1a1441be7ad7e55" dependencies = [ "convert_case", "proc-macro2", "quote", "structmeta", - "syn 2.0.71", + "syn", ] [[package]] name = "meilisearch-sdk" -version = "0.27.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d5ded866ed900150a707bd923f2d178ff64a0981d2306c823e8d8003d95ef2" +checksum = "66958255878d712b4f2dece377a8661b41dc976ff15f564b91bfce8b4a619304" dependencies = [ "async-trait", "bytes", @@ -1504,10 +1693,10 @@ dependencies = [ "log", "meilisearch-index-setting-macro", "pin-project-lite", - "reqwest 0.12.5", + "reqwest 0.12.9", "serde", "serde_json", - "thiserror", + "thiserror 1.0.66", "time", "uuid", "wasm-bindgen-futures", @@ -1546,7 +1735,7 @@ dependencies = [ "metrics", "metrics-util", "quanta", - "thiserror", + "thiserror 1.0.66", "tokio", "tracing", ] @@ -1559,7 +1748,7 @@ checksum = "4259040465c955f9f2f1a4a8a16dc46726169bca0f88e8fb2dbeced487c3e828" dependencies = [ "crossbeam-epoch", "crossbeam-utils", - "hashbrown 0.14.5", + "hashbrown", "metrics", "num_cpus", "quanta", @@ -1599,13 +1788,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.11" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi", "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1751,7 +1941,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "sha2", - "thiserror", + "thiserror 1.0.66", "url", ] @@ -1766,9 +1956,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "openssl" @@ -1793,7 +1983,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] @@ -1816,12 +2006,12 @@ dependencies = [ [[package]] name = "ordered-multimap" -version = "0.6.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ed8acf08e98e744e5384c8bc63ceb0364e68a6854187221c18df61c4797690e" +checksum = "49203cdcae0030493bad186b28da2fa25645fa276a51b6fec8010d281e02ef79" dependencies = [ "dlv-list", - "hashbrown 0.13.2", + "hashbrown", ] [[package]] @@ -1841,6 +2031,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + [[package]] name = "parking_lot" version = "0.12.3" @@ -1909,7 +2105,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" dependencies = [ "memchr", - "thiserror", + "thiserror 1.0.66", "ucd-trie", ] @@ -1933,7 +2129,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] @@ -1949,22 +2145,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] @@ -2025,34 +2221,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "proc-macro-error-attr2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" dependencies = [ - "proc-macro-error-attr", "proc-macro2", "quote", - "syn 1.0.109", - "version_check", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "proc-macro-error2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" dependencies = [ + "proc-macro-error-attr2", "proc-macro2", "quote", - "version_check", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "307e3004becf10f5a6e0d59d20f3cd28231b0e0827a96cd3e0ce6d14bc1e4bb3" dependencies = [ "unicode-ident", ] @@ -2084,7 +2278,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls 0.23.11", - "thiserror", + "thiserror 1.0.66", "tokio", "tracing", ] @@ -2101,7 +2295,7 @@ dependencies = [ "rustc-hash", "rustls 0.23.11", "slab", - "thiserror", + "thiserror 1.0.66", "tinyvec", "tracing", ] @@ -2201,14 +2395,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -2222,13 +2416,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -2239,9 +2433,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" @@ -2281,14 +2475,14 @@ dependencies = [ "wasm-bindgen-futures", "web-sys", "webpki-roots 0.25.4", - "winreg 0.50.0", + "winreg", ] [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64 0.22.1", "bytes", @@ -2330,7 +2524,7 @@ dependencies = [ "wasm-streams", "web-sys", "webpki-roots 0.26.3", - "winreg 0.52.0", + "windows-registry", ] [[package]] @@ -2404,9 +2598,9 @@ dependencies = [ [[package]] name = "rust-ini" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e2a3bcec1f113553ef1c88aae6c020a369d03d55b58de9869a0908930385091" +checksum = "3e0698206bcb8882bf2a9ecb4c1e7785db57ff052297085a6efd4fe42302068a" dependencies = [ "cfg-if", "ordered-multimap", @@ -2557,9 +2751,9 @@ dependencies = [ [[package]] name = "secrecy" -version = "0.8.0" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +checksum = "e891af845473308773346dc847b2c23ee78fe442e0472ac50e22a18a93d3ae5a" dependencies = [ "serde", "zeroize", @@ -2602,7 +2796,7 @@ checksum = "5484316556650182f03b43d4c746ce0e3e48074a21e2f51244b648b6542e1066" dependencies = [ "httpdate", "native-tls", - "reqwest 0.12.5", + "reqwest 0.12.9", "sentry-backtrace", "sentry-contexts", "sentry-core", @@ -2696,7 +2890,7 @@ dependencies = [ "rand", "serde", "serde_json", - "thiserror", + "thiserror 1.0.66", "time", "url", "uuid", @@ -2704,22 +2898,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.204" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] @@ -2737,11 +2931,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -2847,6 +3042,9 @@ name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] [[package]] name = "socket2" @@ -2889,9 +3087,9 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" +checksum = "93334716a037193fac19df402f8571269c84a00852f6a7066b5d2616dcd64d3e" dependencies = [ "sqlx-core", "sqlx-macros", @@ -2902,11 +3100,10 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" +checksum = "d4d8060b456358185f7d50c55d9b5066ad956956fddec42ee2e8567134a8936e" dependencies = [ - "ahash", "atoi", "bigdecimal", "byteorder", @@ -2921,7 +3118,8 @@ dependencies = [ "futures-intrusive", "futures-io", "futures-util", - "hashlink", + "hashbrown", + "hashlink 0.9.1", "hex", "indexmap", "log", @@ -2929,40 +3127,40 @@ dependencies = [ "once_cell", "paste", "percent-encoding", - "rustls 0.21.12", - "rustls-pemfile 1.0.4", + "rustls 0.23.11", + "rustls-pemfile 2.1.2", "serde", "serde_json", "sha2", "smallvec", "sqlformat", - "thiserror", + "thiserror 1.0.66", "tokio", "tokio-stream", "tracing", "url", "uuid", - "webpki-roots 0.25.4", + "webpki-roots 0.26.3", ] [[package]] name = "sqlx-macros" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" +checksum = "cac0692bcc9de3b073e8d747391827297e075c7710ff6276d9f7a1f3d58c6657" dependencies = [ "proc-macro2", "quote", "sqlx-core", "sqlx-macros-core", - "syn 1.0.109", + "syn", ] [[package]] name = "sqlx-macros-core" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" +checksum = "1804e8a7c7865599c9c79be146dc8a9fd8cc86935fa641d3ea58e5f0688abaa5" dependencies = [ "dotenvy", "either", @@ -2978,7 +3176,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 1.0.109", + "syn", "tempfile", "tokio", "url", @@ -2986,12 +3184,12 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" +checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a" dependencies = [ "atoi", - "base64 0.21.7", + "base64 0.22.1", "bigdecimal", "bitflags 2.6.0", "byteorder", @@ -3023,7 +3221,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 1.0.66", "tracing", "uuid", "whoami", @@ -3031,12 +3229,12 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" +checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8" dependencies = [ "atoi", - "base64 0.21.7", + "base64 0.22.1", "bigdecimal", "bitflags 2.6.0", "byteorder", @@ -3065,7 +3263,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 1.0.66", "tracing", "uuid", "whoami", @@ -3073,9 +3271,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" +checksum = "d5b2cf34a45953bfd3daaf3db0f7a7878ab9b7a6b91b422d24a7a9e4c857b680" dependencies = [ "atoi", "chrono", @@ -3089,13 +3287,19 @@ dependencies = [ "log", "percent-encoding", "serde", + "serde_urlencoded", "sqlx-core", "tracing", "url", - "urlencoding", "uuid", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "stringprep" version = "0.1.5" @@ -3107,6 +3311,12 @@ dependencies = [ "unicode-properties", ] +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "structmeta" version = "0.3.0" @@ -3116,7 +3326,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive", - "syn 2.0.71", + "syn", ] [[package]] @@ -3127,7 +3337,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] @@ -3138,20 +3348,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -3169,6 +3368,20 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "system-configuration" @@ -3205,22 +3418,42 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d171f59dbaa811dbbb1aee1e73db92ec2b122911a48e1390dfe327a821ddede" +dependencies = [ + "thiserror-impl 1.0.66", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl 2.0.3", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b08be0f17bd307950653ce45db00cd31200d82b624b36e181337d9c7d92765b5" dependencies = [ - "thiserror-impl", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] @@ -3273,6 +3506,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -3290,32 +3533,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.1" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] @@ -3362,9 +3604,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -3423,6 +3665,22 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower-cookies" version = "0.10.0" @@ -3445,6 +3703,22 @@ name = "tower-http" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +dependencies = [ + "bitflags 2.6.0", + "bytes", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "pin-project-lite", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697" dependencies = [ "bitflags 2.6.0", "bytes", @@ -3467,21 +3741,21 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tower-sessions" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2d9b6f0c4938eed0eefd9cce19319b4bdad10e11ca9d8c3be373ce734bbfd63" +checksum = "65856c81ee244e0f8a55ab0f7b769b72fbde387c235f0a73cd97c579818d05eb" dependencies = [ "async-trait", "http 1.1.0", @@ -3497,9 +3771,9 @@ dependencies = [ [[package]] name = "tower-sessions-core" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38767064990c327ec1d92bba2576dce0944750e9c9ae021f12ebc72de77ac406" +checksum = "fb6abbfcaf6436ec5a772cd9f965401da12db793e404ae6134eac066fa5a04f3" dependencies = [ "async-trait", "axum-core", @@ -3510,7 +3784,7 @@ dependencies = [ "rand", "serde", "serde_json", - "thiserror", + "thiserror 1.0.66", "time", "tokio", "tracing", @@ -3518,9 +3792,9 @@ dependencies = [ [[package]] name = "tower-sessions-memory-store" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8b09bbe2c138a9b0ebf307dc6e6a4f7723c59545e0f4fe5e329a89868164ae3" +checksum = "7fad75660c8afbe74f4e7cbbe8e9090171a056b57370ea4d7d5e9eb3e4af3092" dependencies = [ "async-trait", "time", @@ -3530,14 +3804,14 @@ dependencies = [ [[package]] name = "tower-sessions-redis-store" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55142772c0e4e8e5eb660f09b13c215eb7b4623ccf7c03f611773efa8bf07402" +checksum = "b7d9f0fdeebdc2c6accbc760a585c2932bf6eebf68537715e8ff199dfd9b5d03" dependencies = [ "async-trait", "fred", "rmp-serde", - "thiserror", + "thiserror 1.0.66", "time", "tower-sessions-core", ] @@ -3562,7 +3836,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", ] [[package]] @@ -3716,11 +3990,23 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "uuid" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom", "serde", @@ -3729,12 +4015,12 @@ dependencies = [ [[package]] name = "validator" -version = "0.16.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b92f40481c04ff1f4f61f304d61793c7b56ff76ac1469f1beb199b1445b253bd" +checksum = "d0b4a29d8709210980a09379f27ee31549b73292c87ab9899beee1c0d3be6303" dependencies = [ - "idna 0.4.0", - "lazy_static", + "idna 1.0.3", + "once_cell", "regex", "serde", "serde_derive", @@ -3745,28 +4031,16 @@ dependencies = [ [[package]] name = "validator_derive" -version = "0.16.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc44ca3088bb3ba384d9aecf40c6a23a676ce23e09bdaca2073d99c207f864af" +checksum = "bac855a2ce6f843beb229757e6e570a42e837bcb15e5f449dd48d5747d41bf77" dependencies = [ - "if_chain", - "lazy_static", - "proc-macro-error", + "darling", + "once_cell", + "proc-macro-error2", "proc-macro2", "quote", - "regex", - "syn 1.0.109", - "validator_types", -] - -[[package]] -name = "validator_types" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111abfe30072511849c5910134e8baf8dc05de4c0e5903d681cbd5c9c4d611e3" -dependencies = [ - "proc-macro2", - "syn 1.0.109", + "syn", ] [[package]] @@ -3829,7 +4103,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.71", + "syn", "wasm-bindgen-shared", ] @@ -3863,7 +4137,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3963,6 +4237,36 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -4122,22 +4426,26 @@ dependencies = [ ] [[package]] -name = "winreg" -version = "0.52.0" +name = "write16" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" [[package]] -name = "yaml-rust" -version = "0.4.5" +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yaml-rust2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +checksum = "8902160c4e6f2fb145dbe9d6760a75e3c9522d8bf796ed7047c85919ac7115f8" dependencies = [ - "linked-hash-map", + "arraydeque", + "encoding_rs", + "hashlink 0.8.4", ] [[package]] @@ -4148,7 +4456,31 @@ checksum = "b0144f1a16a199846cb21024da74edd930b43443463292f536b7110b4855b5c6" dependencies = [ "form_urlencoded", "serde", - "thiserror", + "thiserror 1.0.66", +] + +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] @@ -4168,7 +4500,28 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] @@ -4176,3 +4529,25 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/axum1/Cargo.toml b/axum1/Cargo.toml index bcbface..4be4c88 100644 --- a/axum1/Cargo.toml +++ b/axum1/Cargo.toml @@ -7,26 +7,26 @@ license = "MIT OR Apache-2.0" description = "A backend for recipe app" [dependencies] -anyhow = "1.0.80" -thiserror = "1.0.57" +anyhow = "1.0.93" +thiserror = "2.0.3" # our choice as a web framework, and other related utilities -axum = { version = "0.7.4", features = ["json", "multipart"] } -tokio = { version = "1.36.0", features = ["full"] } -tokio-util = { version = "0.7", features = ["io"] } -uuid = { version = "1", features = ["v4", "serde"] } -axum-extra = { version = "0.9.2", features = ["cookie", "cookie-signed", "form"] } -tower-http = { version = "0.5.2", features = ["add-extension", "trace", "cors", "fs", "limit"] } +axum = { version = "0.7.9", features = ["json", "multipart"] } +tokio = { version = "1.41.1", features = ["full"] } +tokio-util = { version = "0.7.12", features = ["io"] } +uuid = { version = "1.11", features = ["v4", "serde"] } +axum-extra = { version = "0.9.6", features = ["cookie", "cookie-signed", "form"] } +tower-http = { version = "0.6.2", features = ["add-extension", "trace", "cors", "fs", "limit"] } # for handling dates chrono = { version = "0.4.35", features = ["serde"] } time = { version = "0.3.30", features = ["formatting", "serde", "serde-well-known"] } # for configuration and auxiliary things -config = "0.14.0" -dotenv = "0.15.0" +config = "0.14.1" +dotenvy = "0.15.0" rand = "0.8.5" # (de)serialization -serde = { version = "1.0.197", features = ["derive"] } +serde = { version = "1.0.215", features = ["derive"] } # database interaction -sqlx = { version = "0.7.3", features = ["runtime-tokio-rustls", "any", "postgres", "json", "macros", "chrono", "uuid", "migrate", "bigdecimal"], default-features = false } +sqlx = { version = "0.8.1", features = ["runtime-tokio-rustls", "any", "postgres", "json", "macros", "chrono", "uuid", "migrate", "bigdecimal"], default-features = false } # tracing and logging utilites sentry = "0.34.0" sentry-tracing = "0.34" @@ -38,26 +38,29 @@ axum-prometheus = "0.7.0" # password hashing argon2 = { version = "0.5", features = ["std"] } # for avoiding exposing sensitive information -secrecy = { version = "0.8.0", features = ["serde"] } +secrecy = { version = "0.10.3", features = ["serde"] } # session ext -tower = "0.4.13" -futures = "0.3" +tower = "0.5.1" +futures = "0.3.31" # emails -reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] } -meilisearch-sdk = "0.27.0" -serde_json = "1.0.109" +reqwest = { version = "0.12.9", default-features = false, features = ["json", "rustls-tls"] } +meilisearch-sdk = "0.27.1" +serde_json = "1.0.133" # OAuth oauth2 = "4.4.2" # Input validation -validator = { version = "0.16", features = ["derive"] } +validator = { version = "0.19.0", features = ["derive"] } # regex (mostly for validation) and utilities -regex = "1.10.3" -once_cell = "1.19.0" -axum-macros = "0.4.1" +regex = "1.11" +once_cell = "1.20.2" +axum-macros = "0.4.2" base64 = "0.22" blake3 = "*" paste = "1.0.14" -async-stream = "0.3.5" -pin-project = "1.1.3" -tower-sessions = "0.12.2" -tower-sessions-redis-store = "0.13.0" +async-stream = "0.3.6" +pin-project = "1.1.7" +tower-sessions = "0.13.0" +tower-sessions-redis-store = "0.14.0" + +[profile.dev.package.sqlx-macros] +opt-level = 3 diff --git a/axum1/k8s/app/deployment.yaml b/axum1/k8s/app/deployment.yaml index abb68c1..c2f13d1 100644 --- a/axum1/k8s/app/deployment.yaml +++ b/axum1/k8s/app/deployment.yaml @@ -19,12 +19,20 @@ spec: ports: - name: http containerPort: 3000 + resources: + limits: + memory: "128Mi" + cpu: "500m" + requests: + memory: "64Mi" + cpu: "100m" livenessProbe: httpGet: path: /admin/health_check port: 3000 initialDelaySeconds: 10 periodSeconds: 20 + --- apiVersion: v1 kind: Service diff --git a/axum1/src/cli/manager.rs b/axum1/src/cli/manager.rs index d9f5a31..dce9961 100644 --- a/axum1/src/cli/manager.rs +++ b/axum1/src/cli/manager.rs @@ -7,13 +7,15 @@ use crate::queue::get_connection_pool; use crate::search::run_meili_indexer; use crate::task::PausableFutureSupervisor; use crate::utils::report_exit; +use std::sync::{Arc, Mutex}; pub async fn cli_manager( - config: Settings, + config: Arc>, mut supervisor: PausableFutureSupervisor, mut _worker: PausableFutureSupervisor, ) -> Result<(), anyhow::Error> { - let socket_path = config + let mut cfg = config.lock().unwrap().clone(); + let socket_path = cfg .application_settings .cli_unix_socket .as_ref() @@ -45,7 +47,7 @@ pub async fn cli_manager( match msg.as_ref() { "index" => { tracing::warn!("Requested MeiliSearch indexing through CLI.."); - let result = tokio::spawn(run_meili_indexer_once(config.clone())).await; + let result = tokio::spawn(run_meili_indexer_once(Arc::clone(&config))).await; report_exit("Meili indexing", result); socket.write_all(b"ok").await?; supervisor.pause(); @@ -60,6 +62,12 @@ pub async fn cli_manager( supervisor.pause(); socket.write_all(b"ok").await?; } + "reload_config" => { + tracing::warn!("Reloading configuration.."); + cfg.reload()?; + tracing::info!("Configuration reloaded."); + socket.write_all(b"ok").await?; + } cmd => { tracing::warn!("Received command '{cmd}', which is not valid in this context."); socket.write_all(b"error").await?; @@ -70,8 +78,11 @@ pub async fn cli_manager( // TODO: it's really similar to other functions in `search.rs`. I'm sure there's a better way. // Currently this is only to work around `tokio::spawn` 'static bound. -pub async fn run_meili_indexer_once(config: Settings) -> Result<(), anyhow::Error> { - let meili_client = Client::new(config.meili.url, Some(config.meili.master_key))?; - let pool = get_connection_pool(&config.database); +pub async fn run_meili_indexer_once(config: Arc>) -> Result<(), anyhow::Error> { + let Settings { + database, meili, .. + } = config.lock().unwrap().clone(); + let meili_client = Client::new(meili.url, Some(meili.master_key))?; + let pool = get_connection_pool(&database); run_meili_indexer(&pool, &meili_client).await } diff --git a/axum1/src/config.rs b/axum1/src/config.rs index 4d1e4be..219f355 100644 --- a/axum1/src/config.rs +++ b/axum1/src/config.rs @@ -1,4 +1,4 @@ -use secrecy::{ExposeSecret, Secret}; +use secrecy::{ExposeSecret, SecretString}; use serde::Deserialize; use sqlx::{ postgres::{PgConnectOptions, PgSslMode}, @@ -22,6 +22,14 @@ pub struct Settings { pub oauth: OAuth, } +impl Settings { + // TODO: Not everything can be changed at runtime. + pub fn reload(&mut self) -> anyhow::Result<()> { + get_config().map(|new_config| *self = new_config)?; + Ok(()) + } +} + #[derive(Deserialize, Clone)] pub struct ApplicationSettings { pub port: u16, @@ -43,7 +51,7 @@ pub struct MeiliConfig { pub struct EmailClientSettings { pub base_url: String, pub sender_email: String, - pub authorization_token: Secret, + pub authorization_token: SecretString, pub timeout_milliseconds: u64, } @@ -87,7 +95,7 @@ impl EmailClientSettings { #[derive(Deserialize, Clone)] pub struct DatabaseSettings { pub username: String, - pub password: Secret, + pub password: SecretString, pub port: u16, pub host: String, pub database_name: String, @@ -100,7 +108,7 @@ pub struct RedisSettings { pub port: u16, pub secret_key: String, pub username: Option, - pub password: Option>, + pub password: Option, } impl DatabaseSettings { @@ -194,10 +202,10 @@ impl TryFrom for Environment { type Error = String; fn try_from(s: String) -> Result { - match s.to_lowercase().as_str() { - "local" => Ok(Self::Local), - "production" => Ok(Self::Production), - "ci" => Ok(Self::CI), + match s { + s if s.eq_ignore_ascii_case("local") => Ok(Self::Local), + s if s.eq_ignore_ascii_case("production") => Ok(Self::Production), + s if s.eq_ignore_ascii_case("ci") => Ok(Self::CI), other => Err(format!( "{} is not a supported environment. Use either `local`, `ci` or `production`.", other diff --git a/axum1/src/email.rs b/axum1/src/email.rs index b3fb8c3..a0f0330 100644 --- a/axum1/src/email.rs +++ b/axum1/src/email.rs @@ -1,5 +1,5 @@ use reqwest::Client; -use secrecy::{ExposeSecret, Secret}; +use secrecy::{ExposeSecret, SecretString}; use crate::{config::EmailClientSettings, error::ApiError}; @@ -8,18 +8,12 @@ pub struct Email(String); impl Email { pub fn parse(s: String) -> Result { - if validator::validate_email(&s) { + if validator::ValidateEmail::validate_email(&s) { Ok(Self(s)) } else { Err(ApiError::unprocessable_entity([("email", "invalid email")])) } } - - /// # Safety - /// ... - pub unsafe fn new_unchecked(s: String) -> Self { - Self(s) - } } impl AsRef for Email { @@ -45,14 +39,14 @@ pub struct EmailClient { http_client: Client, base_url: String, sender: String, - authorization_token: Secret, + authorization_token: SecretString, } impl EmailClient { pub fn new( base_url: String, sender: String, - authorization_token: Secret, + authorization_token: SecretString, timeout: std::time::Duration, ) -> Self { let http_client = Client::builder().timeout(timeout).build().unwrap(); diff --git a/axum1/src/extractors.rs b/axum1/src/extractors.rs index 98856ef..feae8ef 100644 --- a/axum1/src/extractors.rs +++ b/axum1/src/extractors.rs @@ -1,6 +1,6 @@ use std::{convert::Infallible, ops::Deref}; -use crate::{config::ApplicationSettings, error::ApiError, state::AppState}; +use crate::{error::ApiError, state::AppState}; use axum::{ async_trait, extract::{FromRef, FromRequestParts}, @@ -112,14 +112,13 @@ where .expect("`SessionLayer` should be added"); let AppState { - db_pool, - config: - ApplicationSettings { - daily_upload_limit_bytes, - .. - }, - .. + db_pool, config, .. } = AppState::from_ref(state); + let daily_upload_limit_bytes = config + .lock() + .unwrap() + .application_settings + .daily_upload_limit_bytes; let mut db = db_pool.acquire().await?; diff --git a/axum1/src/main.rs b/axum1/src/main.rs index 599b0a3..07a3ede 100644 --- a/axum1/src/main.rs +++ b/axum1/src/main.rs @@ -1,3 +1,5 @@ +use std::sync::{Arc, Mutex}; + use axum1::{ cli::cli_manager, config::get_config, @@ -32,18 +34,17 @@ async fn main() -> anyhow::Result<()> { init_tracing_panic_hook(); - let application_task = tokio::spawn(application()); - let worker_task = run_worker_until_stopped(configuration.clone()); - let meili_indexing_task = run_meili_indexer_until_stopped(configuration.clone()); + let cfg = Arc::new(Mutex::new(configuration.clone())); + + let application_task = tokio::spawn(application(Arc::clone(&cfg))); + let worker_task = run_worker_until_stopped(Arc::clone(&cfg)); + let meili_indexing_task = run_meili_indexer_until_stopped(Arc::clone(&cfg)); let (meili_task_spawned, meili_supervisor) = supervised_task(meili_indexing_task); let (worker_task_spawned, worker_supervisor) = supervised_task(worker_task); + let config = Arc::clone(&cfg); - let cli_manager_task = tokio::spawn(cli_manager( - configuration, - meili_supervisor, - worker_supervisor, - )); + let cli_manager_task = tokio::spawn(cli_manager(config, meili_supervisor, worker_supervisor)); tokio::select! { f = application_task => report_exit("server", f), diff --git a/axum1/src/queue/mod.rs b/axum1/src/queue/mod.rs index f7511d7..f44ebfe 100644 --- a/axum1/src/queue/mod.rs +++ b/axum1/src/queue/mod.rs @@ -1,3 +1,4 @@ +use std::sync::{Arc, Mutex}; use std::time::Duration; use sqlx::{postgres::PgPoolOptions, PgPool, Postgres, Transaction}; @@ -14,9 +15,16 @@ pub fn get_connection_pool(configuration: &DatabaseSettings) -> PgPool { .connect_lazy_with(configuration.with_db()) } -pub async fn run_worker_until_stopped(configuration: Settings) -> Result<(), anyhow::Error> { - let connection_pool = get_connection_pool(&configuration.database); - let email_client = configuration.email_client.client(); +pub async fn run_worker_until_stopped( + configuration: Arc>, +) -> Result<(), anyhow::Error> { + let Settings { + database, + email_client, + .. + } = configuration.lock().unwrap().clone(); + let connection_pool = get_connection_pool(&database); + let email_client = email_client.client(); worker_loop(connection_pool, email_client).await } @@ -49,8 +57,8 @@ pub async fn try_execute_task( } let (mut transaction, confirmation_id, email) = task.unwrap(); Span::current() - .record("confirmation_id", &display(confirmation_id.clone())) - .record("user_email", &display(&email)); + .record("confirmation_id", display(confirmation_id.clone())) + .record("user_email", display(&email)); match Email::parse(email.clone()) { Ok(email) => { if let Err(e) = email_client diff --git a/axum1/src/routes/auth/mod.rs b/axum1/src/routes/auth/mod.rs index 9eabe03..ca43f50 100644 --- a/axum1/src/routes/auth/mod.rs +++ b/axum1/src/routes/auth/mod.rs @@ -4,7 +4,7 @@ use axum::{ routing::{get, post, put}, Form, Json, Router, }; -use secrecy::{ExposeSecret, Secret}; +use secrecy::{ExposeSecret, SecretString}; use sqlx::Acquire; use tower_sessions::Session; use validator::Validate; @@ -69,7 +69,7 @@ async fn me( #[derive(Debug, serde::Deserialize, Clone)] pub struct Credentials { email: String, - password: Secret, + password: SecretString, } async fn authorize( @@ -103,14 +103,14 @@ pub struct Register { #[validate( length(min = 2, max = 40, message = "must be between 2 and 40 characters"), regex( - path = "RE_USERNAME", + path = *RE_USERNAME, message = "can only contain letters, digits and . (period); periods cannot appear at start or end position, neither consecutively." ) )] name: String, #[validate(email(message = "must be a valid email"))] email: String, - password: Secret, + password: SecretString, } #[tracing::instrument(name = "Registering a new user", skip(form, conn))] @@ -169,7 +169,7 @@ async fn register( #[derive(serde::Deserialize)] pub struct UpdatePassword { name: String, - password: Secret, + password: SecretString, } async fn update_password( @@ -263,7 +263,7 @@ struct ForgetPasswordParameters { #[derive(serde::Deserialize)] pub struct ResetPassword { - password: Secret, + password: SecretString, } #[derive(serde::Deserialize)] diff --git a/axum1/src/routes/auth/oauth.rs b/axum1/src/routes/auth/oauth.rs index e43e218..d2cc60e 100644 --- a/axum1/src/routes/auth/oauth.rs +++ b/axum1/src/routes/auth/oauth.rs @@ -4,7 +4,7 @@ use oauth2::{ reqwest::async_http_client, AuthorizationCode, CsrfToken, PkceCodeChallenge, PkceCodeVerifier, Scope, StandardRevocableToken, TokenResponse, }; -use secrecy::{ExposeSecret, Secret}; +use secrecy::{ExposeSecret, SecretString}; use sqlx::Acquire; use super::{confirm::generate_confirmation_token, password::compute_password_hash}; @@ -135,7 +135,7 @@ macro_rules! oauth_handlers_for_provider { u.user_id } else { // Assign a random strong password for the user. - let random_pw = Secret::new(generate_confirmation_token()); + let random_pw = SecretString::from(generate_confirmation_token()); let password_hash = crate::utils::spawn_blocking_with_tracing(move || compute_password_hash(random_pw)) diff --git a/axum1/src/routes/auth/password.rs b/axum1/src/routes/auth/password.rs index dc68ace..f3c5a8d 100644 --- a/axum1/src/routes/auth/password.rs +++ b/axum1/src/routes/auth/password.rs @@ -3,7 +3,7 @@ use argon2::{ password_hash::SaltString, Algorithm, Argon2, Params, PasswordHash, PasswordHasher, PasswordVerifier, Version, }; -use secrecy::{ExposeSecret, Secret}; +use secrecy::{ExposeSecret, SecretString}; use crate::{error::ApiError, extractors::DatabaseConnection}; @@ -48,7 +48,7 @@ pub async fn validate_credentials( Ok(user_id) } -pub fn compute_password_hash(password: Secret) -> Result, anyhow::Error> { +pub fn compute_password_hash(password: SecretString) -> Result { let salt = SaltString::generate(&mut rand::thread_rng()); let password_hash = Argon2::new( Algorithm::Argon2id, @@ -57,5 +57,5 @@ pub fn compute_password_hash(password: Secret) -> Result, ) .hash_password(password.expose_secret().as_bytes(), &salt)? .to_string(); - Ok(Secret::new(password_hash)) + Ok(SecretString::from(password_hash)) } diff --git a/axum1/src/routes/ingredient/mod.rs b/axum1/src/routes/ingredient/mod.rs index acff961..1bbdac6 100644 --- a/axum1/src/routes/ingredient/mod.rs +++ b/axum1/src/routes/ingredient/mod.rs @@ -8,10 +8,7 @@ use axum::{ // See: https://github.com/tokio-rs/axum/pull/1031 use axum_extra::extract::Form; use serde::{Deserialize, Serialize}; -use sqlx::{ - postgres::{PgHasArrayType, PgTypeInfo}, - Connection, -}; +use sqlx::Connection; use crate::{ error::ApiError, @@ -72,12 +69,6 @@ pub enum FoodCategory { Uncategorized, } -impl PgHasArrayType for FoodCategory { - fn array_type_info() -> PgTypeInfo { - PgTypeInfo::with_name("_food_category") - } -} - #[derive(sqlx::FromRow, Debug, Serialize, Deserialize)] pub struct Ingredient { pub name: String, diff --git a/axum1/src/routes/recipe/helpers.rs b/axum1/src/routes/recipe/helpers.rs index 2e9ea4d..8b982fb 100644 --- a/axum1/src/routes/recipe/helpers.rs +++ b/axum1/src/routes/recipe/helpers.rs @@ -1,5 +1,4 @@ use serde::{Deserialize, Serialize}; -use sqlx::postgres::{PgHasArrayType, PgTypeInfo}; #[derive(sqlx::Type, Debug, Deserialize, Serialize, Clone)] #[sqlx(rename_all = "snake_case", type_name = "difficulty_level")] @@ -14,12 +13,6 @@ pub enum DifficultyLevel { DoNotAttempt, } -impl PgHasArrayType for DifficultyLevel { - fn array_type_info() -> PgTypeInfo { - PgTypeInfo::with_name("_difficulty_level") - } -} - #[derive(sqlx::Type, Debug, Deserialize, Serialize, Clone)] #[sqlx(rename_all = "snake_case", type_name = "type_by_time")] #[serde(rename_all = "snake_case")] @@ -30,12 +23,6 @@ pub enum TypeByTime { Other, } -impl PgHasArrayType for TypeByTime { - fn array_type_info() -> PgTypeInfo { - PgTypeInfo::with_name("_type_by_time") - } -} - #[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)] #[allow(non_camel_case_types)] pub enum QuantityUnit { diff --git a/axum1/src/routes/recipe/mod.rs b/axum1/src/routes/recipe/mod.rs index f6d858a..b5f99dc 100644 --- a/axum1/src/routes/recipe/mod.rs +++ b/axum1/src/routes/recipe/mod.rs @@ -68,7 +68,7 @@ struct RecipeWithIngredients { message = "should be at least 2 characters, but no more than 250" ), regex( - path = "RE_RECIPE", + path = *RE_RECIPE, message = "only letters, digits, and non-leading and non-trailing dashes are allowed" ) )] @@ -220,7 +220,7 @@ struct InsertIngredient { #[tracing::instrument(skip(conn))] async fn add_or_update_ingredient_to_recipe( DatabaseConnection(mut conn): DatabaseConnection, - creator: RecipeCreator, + _creator: RecipeCreator, Path(name): Path, Form(ingredient): Form, ) -> Result<(), ApiError> { @@ -265,7 +265,7 @@ struct NamedIngredient { async fn delete_ingredient_from_recipe( DatabaseConnection(mut conn): DatabaseConnection, Path(name): Path, - creator: RecipeCreator, + _creator: RecipeCreator, Form(ingredient): Form, ) -> Result<(), ApiError> { let mut tx = conn.begin().await?; diff --git a/axum1/src/search.rs b/axum1/src/search.rs index 9d4e32b..8bd0701 100644 --- a/axum1/src/search.rs +++ b/axum1/src/search.rs @@ -1,15 +1,22 @@ +use std::sync::{Arc, Mutex}; + use meilisearch_sdk::client::Client; use sqlx::{Pool, Postgres}; use crate::{config::Settings, queue::get_connection_pool, routes::ingredient::FoodCategory}; -pub async fn run_meili_indexer_until_stopped(config: Settings) -> Result<(), anyhow::Error> { - let meili_client = Client::new(config.meili.url, Some(config.meili.master_key))?; - let pool = get_connection_pool(&config.database); +pub async fn run_meili_indexer_until_stopped( + config: Arc>, +) -> Result<(), anyhow::Error> { + let Settings { + database, meili, .. + } = config.lock().unwrap().clone(); + let meili_client = Client::new(meili.url, Some(meili.master_key))?; + let pool = get_connection_pool(&database); // TODO: These defaults are hidden here, maybe there's a better place for them? - let retry_seconds = config.meili.retry_seconds.unwrap_or(60); - let max_retries = config.meili.max_retries.unwrap_or(5); - let indexing_interval_seconds = config.meili.indexing_interval_seconds.unwrap_or(3600); + let retry_seconds = meili.retry_seconds.unwrap_or(60); + let max_retries = meili.max_retries.unwrap_or(5); + let indexing_interval_seconds = meili.indexing_interval_seconds.unwrap_or(3600); let mut current_retries = 0; // I don't really know whether this is a good idea yet. Maybe the whole MeiliSearch indexing should be its own crate. loop { diff --git a/axum1/src/startup.rs b/axum1/src/startup.rs index 46d77c7..30f412d 100644 --- a/axum1/src/startup.rs +++ b/axum1/src/startup.rs @@ -1,4 +1,5 @@ use crate::{ + config::Settings, email::EmailClient, routes::{admin, auth, ingredient, recipe}, sse::{sse_handler, Notification}, @@ -8,21 +9,25 @@ use crate::{ }; use anyhow::Context; use axum::{ + extract::State, http::HeaderValue, routing::{get, get_service}, Extension, Router, }; use axum_prometheus::PrometheusMetricLayerBuilder; use sqlx::postgres::PgPoolOptions; -use std::{net::SocketAddr, sync::Arc}; +use std::{ + net::SocketAddr, + sync::{Arc, Mutex}, +}; use time::Duration; use tokio::net::TcpListener; use tower_http::{cors::CorsLayer, services::ServeDir, trace::TraceLayer}; use tower_sessions::{Expiry, SessionManagerLayer}; use tower_sessions_redis_store::{fred::prelude::*, RedisStore}; -pub async fn application() -> Result<(), anyhow::Error> { - dotenv::dotenv().ok(); +pub async fn application(dynamic_cfg: Arc>) -> Result<(), anyhow::Error> { + dotenvy::dotenv().ok(); let config = crate::config::get_config().expect("Configuration file is missing"); @@ -80,7 +85,7 @@ pub async fn application() -> Result<(), anyhow::Error> { let app_state = AppState { db_pool, - config: config.application_settings, + config: dynamic_cfg, email_client, tx, rx, diff --git a/axum1/src/state.rs b/axum1/src/state.rs index a28a1e8..19651d6 100644 --- a/axum1/src/state.rs +++ b/axum1/src/state.rs @@ -1,14 +1,14 @@ -use std::sync::Arc; +use std::sync::{Arc, Mutex}; use sqlx::PgPool; use tokio::sync::broadcast::{Receiver, Sender}; -use crate::{config::ApplicationSettings, email::EmailClient, sse::Notification}; +use crate::{config::Settings, email::EmailClient, sse::Notification}; #[derive(Clone)] pub struct AppState { pub db_pool: PgPool, - pub config: ApplicationSettings, + pub config: Arc>, pub tx: Arc>, pub rx: Arc>, pub email_client: EmailClient,