From a851f68425b8af81174b6917c3d2e680b0456ad5 Mon Sep 17 00:00:00 2001 From: Nicolas Haquet Date: Thu, 7 Dec 2023 18:15:40 +0100 Subject: [PATCH 1/3] [FIX] test identity --- src/utils/test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/test.rs b/src/utils/test.rs index e0cfd46..174372d 100644 --- a/src/utils/test.rs +++ b/src/utils/test.rs @@ -144,7 +144,7 @@ pub static IDENTITY_USER: &str = r#" "group":{ "7113206d-afc0-41ad-bbca-b1e8113beb82": { "name" : "awesome", - "projects" : [122, 334, 456] + "project" : [122, 334, 456] } } }, From 479fb5e3537f309a3f30c813efaad9e87425f6e8 Mon Sep 17 00:00:00 2001 From: Nicolas Haquet Date: Thu, 15 Feb 2024 00:49:54 +0100 Subject: [PATCH 2/3] [ADD] send error to kafka + some fix --- Cargo.lock | 819 ++++++++++++++++++++++-------------- Cargo.toml | 14 +- src/config.rs | 67 +-- src/controller/list.rs | 50 +-- src/controller/sync.rs | 165 +++----- src/controller/update.rs | 85 ++-- src/handelers.rs | 13 +- src/main.rs | 71 +++- src/router.rs | 228 +++++++--- src/utils/error.rs | 23 + src/utils/kafka.rs | 62 +++ src/utils/mod.rs | 3 + src/utils/opa.rs | 2 +- src/utils/test.rs | 4 +- {test => tests}/config.toml | 11 +- 15 files changed, 959 insertions(+), 658 deletions(-) create mode 100644 src/utils/error.rs create mode 100644 src/utils/kafka.rs rename {test => tests}/config.toml (60%) diff --git a/Cargo.lock b/Cargo.lock index 2c6da4d..783afd6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom", "once_cell", @@ -39,9 +39,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "arc-swap" @@ -78,18 +78,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -113,7 +113,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fcf00bc6d5abb29b5f97e3c61a90b6d3caa12f3faf897d4a3e3607c050a35a7" dependencies = [ - "http", + "http 0.2.11", "log", "native-tls", "serde", @@ -160,13 +160,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.3.4", "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" +dependencies = [ + "async-trait", + "axum-core 0.4.3", + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.1.0", + "hyper-util", "itoa", "matchit", "memchr", @@ -183,6 +212,7 @@ dependencies = [ "tower", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -194,36 +224,69 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.11", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", "tower-service", ] +[[package]] +name = "axum-core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "axum-extra" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ab90e7b70bea63a153137162affb6a0bce26b584c24a4c7885509783e2cf30b" +checksum = "895ff42f72016617773af68fb90da2a9677d89c62338ec09162d4909d86fdd8f" dependencies = [ - "axum", - "axum-core", + "axum 0.7.4", + "axum-core 0.4.3", "bytes", - "cookie 0.17.0", + "cookie", "futures-util", - "http", - "http-body", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", "mime", "pin-project-lite", "serde", - "tokio", "tower", "tower-layer", "tower-service", ] +[[package]] +name = "axum-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00c055ee2d014ae5981ce1016374e8213682aa14d9bf40e48ab48b5f3ef20eaa" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "backtrace" version = "0.3.69" @@ -247,9 +310,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "binascii" @@ -265,9 +328,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block-buffer" @@ -286,9 +349,9 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" [[package]] name = "bytes" @@ -322,11 +385,10 @@ dependencies = [ [[package]] name = "colored" -version = "2.0.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ - "is-terminal", "lazy_static", "windows-sys 0.48.0", ] @@ -345,17 +407,6 @@ dependencies = [ "tokio-util", ] -[[package]] -name = "cookie" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" -dependencies = [ - "percent-encoding", - "time", - "version_check", -] - [[package]] name = "cookie" version = "0.18.0" @@ -369,9 +420,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -379,37 +430,33 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-common" @@ -423,9 +470,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -457,11 +504,11 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35b50dba0afdca80b187392b24f2499a88c336d5a8493e4b4ccfb608708be56a" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -503,9 +550,9 @@ checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "email_address" @@ -549,9 +596,9 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "figment" -version = "0.10.12" +version = "0.10.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "649f3e5d826594057e9a519626304d8da859ea8a0b18ce99500c586b8d45faee" +checksum = "2b6e5bc7bd59d60d0d45a6ccab6cf0f4ce28698fb4e81e750ddf229c9b824026" dependencies = [ "atomic 0.6.0", "pear", @@ -563,14 +610,14 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", - "windows-sys 0.48.0", + "redox_syscall", + "windows-sys 0.52.0", ] [[package]] @@ -620,9 +667,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -635,9 +682,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -645,15 +692,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -662,38 +709,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -732,9 +779,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -755,17 +802,36 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.22" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.11", + "indexmap 2.2.3", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", - "indexmap 2.1.0", + "http 1.0.0", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -795,9 +861,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "hex" @@ -816,11 +882,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -834,22 +900,50 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.11", "pin-project-lite", ] [[package]] -name = "http-range-header" -version = "0.3.1" +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.0.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +dependencies = [ + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "pin-project-lite", +] [[package]] name = "httparse" @@ -865,35 +959,54 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.24", + "http 0.2.11", + "http-body 0.4.6", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.5", "tokio", "tower-service", "tracing", "want", ] +[[package]] +name = "hyper" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.2", + "http 1.0.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "tokio", +] + [[package]] name = "hyper-timeout" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.28", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -906,12 +1019,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.28", "native-tls", "tokio", "tokio-native-tls", ] +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "hyper 1.1.0", + "pin-project-lite", + "socket2 0.5.5", + "tokio", +] + [[package]] name = "idna" version = "0.5.0" @@ -934,9 +1063,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -977,13 +1106,13 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", - "windows-sys 0.48.0", + "libc", + "windows-sys 0.52.0", ] [[package]] @@ -997,15 +1126,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -1038,18 +1167,19 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libkafka" -version = "0.1.0" -source = "git+https://github.com/w6d-io/libkafka?branch=develop#7315e2d898dd66a0251f93c7e654770599df4501" +version = "0.2.1" +source = "git+https://github.com/w6d-io/libkafka?branch=develop#8739439e8f261afa585ccafb99299195c733c7ca" dependencies = [ "anyhow", "futures-util", "log", + "openssl", "rdkafka", "thiserror", ] @@ -1060,16 +1190,16 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "libc", - "redox_syscall 0.4.1", + "redox_syscall", ] [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" dependencies = [ "cc", "libc", @@ -1079,9 +1209,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -1131,13 +1261,13 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "maybe-async" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1b8c13cb1f814b634a96b2c725449fe7ed464a7b8781de8688be5ffbd3f305" +checksum = "afc95a651c82daf7004c824405aa1019723644950d488571bd718e3ed84646ed" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.48", ] [[package]] @@ -1148,9 +1278,9 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mime" @@ -1179,18 +1309,18 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "log", @@ -1207,7 +1337,7 @@ dependencies = [ "assert-json-diff", "colored", "futures", - "hyper", + "hyper 0.14.28", "log", "rand", "regex", @@ -1226,7 +1356,7 @@ dependencies = [ "bytes", "encoding_rs", "futures-util", - "http", + "http 0.2.11", "httparse", "log", "memchr", @@ -1267,7 +1397,7 @@ version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "crossbeam-channel", "filetime", "fsevent-sys", @@ -1290,11 +1420,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -1332,26 +1468,26 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.60" +version = "0.10.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" +checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cfg-if", "foreign-types", "libc", @@ -1368,7 +1504,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1377,14 +1513,24 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-src" +version = "300.2.3+3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" -version = "0.9.96" +version = "0.9.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] @@ -1437,16 +1583,16 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "smallvec", "windows-targets 0.48.5", ] [[package]] name = "pear" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a386cd715229d399604b50d1361683fe687066f42d56f54be995bc6868f71c" +checksum = "4ccca0f6c17acc81df8e242ed473ec144cbf5c98037e69aa6d144780aad103c8" dependencies = [ "inlinable_string", "pear_codegen", @@ -1455,14 +1601,14 @@ dependencies = [ [[package]] name = "pear_codegen" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f0f13dac8069c139e8300a6510e3f4143ecf5259c60b116a9b271b4ca0d54" +checksum = "2e22670e8eb757cff11d6c199ca7b987f352f0346e0be4dd23869ec72cb53c77" dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1478,27 +1624,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.1.0", + "indexmap 2.2.3", ] [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1515,9 +1661,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "powerfmt" @@ -1533,12 +1679,12 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1553,9 +1699,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -1568,7 +1714,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "version_check", "yansi", ] @@ -1600,7 +1746,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.39", + "syn 2.0.48", "tempfile", "which", ] @@ -1615,7 +1761,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1639,9 +1785,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1678,11 +1824,12 @@ dependencies = [ [[package]] name = "rdkafka" -version = "0.28.0" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1de127f294f2dba488ed46760b129d5ecbeabbd337ccbf3739cb29d50db2161c" +checksum = "1beea247b9a7600a81d4cc33f659ce1a77e1988323d7d2809c7ed1c21f4c316d" dependencies = [ - "futures", + "futures-channel", + "futures-util", "libc", "log", "rdkafka-sys", @@ -1708,9 +1855,9 @@ dependencies = [ [[package]] name = "redis" -version = "0.23.3" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f49cdc0bb3f412bf8e7d1bd90fe1d9eb10bc5c399ba90973c14662a27b3f8ba" +checksum = "c580d9cbbe1d1b479e8d67cf9daf6a62c957e6846048408b80b43ac3f6af84cd" dependencies = [ "arc-swap", "async-trait", @@ -1730,15 +1877,6 @@ dependencies = [ "url", ] -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -1761,33 +1899,33 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" +checksum = "c4846d4c50d1721b1a3bef8af76924eef20d5e723647333798c1b519b3a9473f" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" +checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] @@ -1802,9 +1940,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -1825,19 +1963,19 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.24", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-tls", "ipnet", "js-sys", @@ -1848,9 +1986,11 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", "system-configuration", "tokio", "tokio-native-tls", @@ -1878,7 +2018,7 @@ dependencies = [ "either", "figment", "futures", - "indexmap 2.1.0", + "indexmap 2.2.3", "log", "memchr", "multer", @@ -1909,11 +2049,11 @@ checksum = "a2238066abf75f21be6cd7dc1a09d5414a671f4246e384e49fe3f8a4936bd04c" dependencies = [ "devise", "glob", - "indexmap 2.1.0", + "indexmap 2.2.3", "proc-macro2", "quote", "rocket_http", - "syn 2.0.39", + "syn 2.0.48", "unicode-xid", "version_check", ] @@ -1924,12 +2064,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37a1663694d059fe5f943ea5481363e48050acedd241d46deb2e27f71110389e" dependencies = [ - "cookie 0.18.0", + "cookie", "either", "futures", - "http", - "hyper", - "indexmap 2.1.0", + "http 0.2.11", + "hyper 0.14.28", + "indexmap 2.2.3", "log", "memchr", "pear", @@ -1948,7 +2088,7 @@ dependencies = [ [[package]] name = "rs-utils" version = "0.2.2" -source = "git+https://github.com/w6d-io/rs-utils#986728b63d93e1ed5acc846a654535c27cf274e7" +source = "git+https://github.com/w6d-io/rs-utils#9c8f211174104dbd314d86c92b11588c31e31e95" dependencies = [ "anyhow", "async-trait", @@ -1989,7 +2129,7 @@ dependencies = [ "futures", "hex", "hmac", - "http", + "http 0.2.11", "log", "maybe-async", "md5", @@ -2015,15 +2155,24 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.25" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", ] [[package]] @@ -2051,9 +2200,9 @@ checksum = "22a197350ece202f19a166d1ad6d9d6de145e1d2a8ef47db299abe164dbd7530" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "same-file" @@ -2066,11 +2215,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2110,18 +2259,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.193" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde-email" -version = "3.0.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f07d6907a91e7d43c1a2f2698a81a1cf025d89daed97fe211b3d25e8cef109" +checksum = "df113b26f73e0d214d25c95f254c7d50b75c85b99a8a4084ac41dd38e738972a" dependencies = [ "email_address", "serde", @@ -2129,20 +2278,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -2151,9 +2300,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" +checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" dependencies = [ "itoa", "serde", @@ -2161,9 +2310,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] @@ -2217,9 +2366,9 @@ dependencies = [ [[package]] name = "similar" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aeaf503862c419d66959f5d7ca015337d864e9c49485d771b732e2a20453597" +checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21" [[package]] name = "sirius" @@ -2227,11 +2376,12 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "axum", + "axum 0.7.4", "axum-extra", + "axum-macros", "figment", "futures", - "hyper", + "hyper 0.14.28", "libkafka", "mime", "mockito", @@ -2242,6 +2392,7 @@ dependencies = [ "serde", "serde-email", "serde_json", + "stream-cancel", "thiserror", "tokio", "tonic", @@ -2264,9 +2415,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smartstring" @@ -2329,6 +2480,17 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "stream-cancel" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9fbf9bd71e4cf18d68a8a0951c0e5b7255920c0cd992c4ff51cddd6ef514a3" +dependencies = [ + "futures-core", + "pin-project", + "tokio", +] + [[package]] name = "subtle" version = "2.5.0" @@ -2348,9 +2510,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -2386,35 +2548,34 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.1" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.4.1", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2429,12 +2590,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -2449,10 +2611,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -2473,9 +2636,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.34.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -2508,7 +2671,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2559,14 +2722,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.0", + "toml_edit 0.22.5", ] [[package]] @@ -2584,39 +2747,39 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.3", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "99e68c159e8f5ba8a28c4eb7b0c0c190d77bb479047ca713270048145a9ad28a" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.1", ] [[package]] name = "tonic" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" dependencies = [ "async-stream", "async-trait", - "axum", - "base64 0.21.5", + "axum 0.6.20", + "base64 0.21.7", "bytes", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.24", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-timeout", "percent-encoding", "pin-project", @@ -2631,15 +2794,15 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" +checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" dependencies = [ "prettyplease", "proc-macro2", "prost-build", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2664,20 +2827,19 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.4.4" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" +checksum = "0da193277a4e2c33e59e09b5861580c33dd0a637c3883d0fa74ba40c0374af2e" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bytes", - "futures-core", - "futures-util", - "http", - "http-body", - "http-range-header", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", "pin-project-lite", "tower-layer", "tower-service", + "tracing", "uuid", ] @@ -2713,7 +2875,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2757,9 +2919,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" @@ -2778,9 +2940,9 @@ dependencies = [ [[package]] name = "uncased" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b9bc53168a4be7402ab86c3aad243a84dd7381d09be0eddc81280c1da95ca68" +checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" dependencies = [ "serde", "version_check", @@ -2797,9 +2959,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -2835,9 +2997,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ "getrandom", "serde", @@ -2888,9 +3050,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2898,24 +3060,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -2925,9 +3087,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2935,28 +3097,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "wasm-streams" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7" +checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" dependencies = [ "futures-util", "js-sys", @@ -2967,9 +3129,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ "js-sys", "wasm-bindgen", @@ -3161,9 +3323,18 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.19" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" +checksum = "d90f4e0f530c4c69f62b80d839e9ef3855edc9cba471a160c4d692deed62b401" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 0663a9a..b76576e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,10 +8,10 @@ edition = "2021" [dependencies] anyhow = "1.0" async-trait = "0.1" -axum = "0.6.*" +axum = "0.7.*" tower = "0.4.13" -tower-http = { version = "0.4.4", features = ["request-id"] } -tokio = { version = "1.34.*", features = ["rt-multi-thread", "macros", "sync"]} +tower-http = { version = "0.5.1", features = ["request-id", "trace"] } +tokio = { version = "1.36.*", features = ["rt-multi-thread", "macros", "sync"]} serde = "1.0.*" serde_json = "1.0.*" rs-utils = {git = "https://github.com/w6d-io/rs-utils",features = ["kratos", "anyhow-rocket"]} @@ -22,12 +22,14 @@ hyper = "0.14.23" ory-kratos-client = "1.0.0" futures = "0.3.26" thiserror = "1.0.38" -axum-extra = { version = "0.8.0", features = ["cookie"] } -tonic = "0.10.*" +axum-extra = { version = "0.9.2", features = ["cookie"] } +tonic = "0.11.*" prost = "0.12.*" reqwest = "0.11.14" serde-email = "3.0.0" uuid = { version = "^1.5", features = ["serde"] } +stream-cancel = "0.8.2" +axum-macros = "0.4.1" [dependencies.libkafka] git = "https://github.com/w6d-io/libkafka" @@ -35,7 +37,7 @@ branch = "develop" features = ["async", "anyhow"] [build-dependencies] -tonic-build = "0.10.*" +tonic-build = "0.11.*" [dev-dependencies] mime = "0.3.17" diff --git a/src/config.rs b/src/config.rs index 7533553..f9aebd7 100644 --- a/src/config.rs +++ b/src/config.rs @@ -2,6 +2,7 @@ use std::{ collections::HashMap, fmt, path::{Path, PathBuf}, + sync::Arc, }; use anyhow::{bail, Result}; @@ -25,47 +26,50 @@ pub const CONFIG_FALLBACK: &str = "test/config.toml"; ///structure containing kafka consumer data #[derive(Deserialize, Clone, Default)] pub struct Producer { - pub broker: String, - pub topic: String, + pub topics: Vec, #[serde(skip)] - pub client: Option>, + pub clients: Option>>>, } impl fmt::Debug for Producer { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let client = match self.client { - Some(_) => "Some(_)", - None => "None", + f.debug_struct("Producer") + .field("topics", &self.topics) + .finish_non_exhaustive() + } +} + +impl Producer { + ///update the producer Producers if needed. + pub fn update(&mut self, broker: &str) -> Result<()> { + let mut new_producer = HashMap::new(); + let producer = match self.clients { + Some(ref mut prod) => prod, + None => &mut new_producer, }; - write!( - f, - "Consumer: {{ - brokers: {}, - topic: {}, - client: {} - }}", - self.broker, self.topic, client - ) + for topic in self.topics.iter() { + producer.insert( + topic.to_owned(), + Arc::new(KafkaProducer::::new( + &default_config(broker), + topic, + )?), + ); + } + Ok(()) } } #[derive(Deserialize, Clone, Default, Debug)] pub struct Kafka { - pub producers: HashMap, + pub broker: String, + pub producers: Producer, } impl Kafka { fn update(&mut self) -> Result<&mut Self> { - let producers = &mut self.producers; - for producer in producers.values_mut() { - let new_producer: KafkaProducer = - KafkaProducer::::new( - &default_config(&producer.broker), - &producer.topic, - )?; - producer.client = Some(new_producer); - } + self.producers.update(&self.broker)?; Ok(self) } } @@ -89,14 +93,19 @@ pub struct Iam { pub client: Option>, } +#[derive(Deserialize, Clone, Default, Debug)] +pub struct Opa { + pub addr: String, + pub mode: String, +} + ///structure containing the configuaration of the application #[derive(Deserialize, Clone, Default, Debug)] pub struct SiriusConfig { // pub prefix: String, - pub mode: String, pub service: Service, pub iam: Iam, - pub opa: String, + pub opa: Opa, pub kratos: Kratos, pub kafka: Kafka, #[serde(skip)] @@ -149,7 +158,7 @@ mod test_config { #[tokio::test] async fn test_update_valid() { let mut config = SiriusConfig::default(); - config.set_path("test/config.toml"); + config.set_path("tests/config.toml"); let res = config.update().await; assert!(res.is_ok()) } @@ -157,7 +166,7 @@ mod test_config { #[tokio::test] async fn test_update_not_valid() { let mut config = SiriusConfig::default(); - config.set_path("test/not_config.toml"); + config.set_path("tests/not_config.toml"); let res = config.update().await; assert!(res.is_err()) } diff --git a/src/controller/list.rs b/src/controller/list.rs index 9a2f9f9..7c88276 100644 --- a/src/controller/list.rs +++ b/src/controller/list.rs @@ -8,7 +8,7 @@ use tracing::{debug, error, info}; use crate::config::SiriusConfig; -fn populate_set(projects: &mut HashSet, mut data: Value, request_id: &str) -> Result<()> { +fn populate_set(projects: &mut HashSet, mut data: Value) -> Result<()> { let data = data.take(); match data { Value::Object(map) => { @@ -28,16 +28,12 @@ fn populate_set(projects: &mut HashSet, mut data: Value, request_id: &st } } } - _ => bail!("{request_id}: This should be a map or an array!"), + _ => bail!("This should be a map or an array!"), } Ok(()) } -fn extract_projects( - projects: &mut HashSet, - mut data: Value, - request_id: &str, -) -> Result<()> { +fn extract_projects(projects: &mut HashSet, mut data: Value) -> Result<()> { debug!("{data:?}"); let data = data .as_object_mut() @@ -45,7 +41,7 @@ fn extract_projects( if !data.is_empty() { for (_, val) in data.into_iter() { if let Some(proj) = val.get_mut("project") { - populate_set(projects, proj.take(), request_id)?; + populate_set(projects, proj.take())?; } } } @@ -53,12 +49,11 @@ fn extract_projects( } pub async fn list_project_controller( - request_id: &str, identity: Identity, - config: SiriusConfig, + config: &SiriusConfig, ) -> Result> { let mut projects = HashSet::new(); - let meta = match &config.mode as &str { + let meta = match &config.opa.mode as &str { "admin" => identity.metadata_admin, "public" => identity.metadata_public, "trait" => identity.traits, @@ -68,33 +63,32 @@ pub async fn list_project_controller( let mut metadata = match meta { Some(mut metadata) => metadata.take(), None => { - error!("{request_id}: no metadata in this user!"); - bail!("{request_id}: no metadata in this user!") + error!("no metadata in this user!"); + bail!("no metadata in this user!") } }; if let Some(data) = metadata.get_mut("project") { - info!("{request_id}: extracting project from project"); - populate_set(&mut projects, data.take(), request_id)?; + info!("extracting project from project"); + populate_set(&mut projects, data.take())?; } if let Some(group) = metadata.get_mut("group") { - info!("{request_id}: extracting project from group"); - extract_projects(&mut projects, group.take(), request_id)?; + info!("extracting project from group"); + extract_projects(&mut projects, group.take())?; } if let Some(orga) = metadata.get_mut("organisation") { - info!("{request_id}: extracting project from orga"); - extract_projects(&mut projects, orga.take(), request_id)?; + info!("extracting project from orga"); + extract_projects(&mut projects, orga.take())?; } Ok(projects) } pub async fn list_controller( - request_id: &str, identity: Identity, data_type: &str, - config: SiriusConfig, + config: &SiriusConfig, ) -> Result> { let mut projects = HashMap::new(); - let meta = match &config.mode as &str { + let meta = match &config.opa.mode as &str { "admin" => &identity.metadata_admin, "public" => &identity.metadata_public, "trait" => &identity.traits, @@ -104,23 +98,21 @@ pub async fn list_controller( let metadata = match meta { Some(metadata) => metadata, None => { - error!("{request_id}: no metadata in this user!"); - bail!("{request_id}: no metadata in this user!") + error!("no metadata in this user!"); + bail!("no metadata in this user!") } }; if let Some(data) = metadata.get(data_type) { - info!("{request_id}: estracting: {data_type}"); + info!("estracting: {data_type}"); let data = data .as_object() .ok_or_else(|| anyhow!("this should be a map!"))?; if !data.is_empty() { for (uuid, map) in data.iter() { - let val = map - .get("name") - .ok_or_else(|| anyhow!("{request_id}: no name found !"))?; + let val = map.get("name").ok_or_else(|| anyhow!("no name found !"))?; let name = val .as_str() - .ok_or_else(|| anyhow!("{request_id}: this should be a string!"))?; + .ok_or_else(|| anyhow!("this should be a string!"))?; projects.insert(uuid.to_owned(), name.to_owned()); } } diff --git a/src/controller/sync.rs b/src/controller/sync.rs index f6e0f29..1bf7bc7 100644 --- a/src/controller/sync.rs +++ b/src/controller/sync.rs @@ -1,10 +1,6 @@ -use std::{collections::HashMap, sync::Arc, time::Duration}; +use std::{collections::HashMap, ops::Deref, sync::Arc}; use anyhow::{anyhow, bail, Result}; -use kafka::{ - producer::{future_producer::DefaultFutureContext, FutureProducer}, - KafkaMessage, KafkaProducer, -}; use ory_kratos_client::models::Identity; use serde_json::{json, Value}; use tonic::Request; @@ -13,15 +9,15 @@ use tracing::{error, log::info}; use crate::{ config::SiriusConfig, permission::{Input, Mode}, + utils::{error::send_error, kafka::send_to_kafka}, }; async fn extract_sync_id( identity: &mut Identity, - request_id: &str, sync_type: &str, config: &Arc, ) -> Result>> { - let mut meta = match &config.mode as &str { + let mut meta = match &config.opa.mode as &str { "admin" => &mut identity.metadata_admin, "public" => &mut identity.metadata_public, "trait" => &mut identity.traits, @@ -31,8 +27,8 @@ async fn extract_sync_id( let metadata = match &mut meta { Some(ref mut metadata) => metadata, None => { - error!("{request_id}: no metadata in this group!"); - bail!("{request_id}: no metadata in this group!") + error!("No metadata in this group!"); + bail!("No metadata in this group!") } }; let mut ret = HashMap::new(); @@ -56,34 +52,13 @@ pub enum SyncMode { Project(Vec), } -fn get_producer( - config: &Arc, - producer: &str, - request_id: &str, -) -> KafkaProducer { - match config.kafka.producers.get(producer) { - Some(producer) => match producer.client.clone() { - Some(p) => p, - None => { - error!("{request_id}: producer not initialized"); - panic!(); - } - }, - None => { - error!("{request_id}: no {producer} producer"); - panic!(); - } - } -} - pub async fn sync_groups( config: Arc, identity: &Identity, - request_id: &str, users: &[(String, Value)], ) -> Result<()> { info!("recuparating groups from identity"); - let meta = match &config.mode as &str { + let meta = match &config.opa.mode as &str { "admin" => &identity.metadata_admin, "public" => &identity.metadata_public, "trait" => &identity.traits, @@ -91,26 +66,20 @@ pub async fn sync_groups( }; let groups = match meta { Some(ref meta) => match meta.get("group") { - Some(grps) => grps - .as_object() - .ok_or_else(|| anyhow!("{request_id}: not an object!"))?, + Some(grps) => grps.as_object().ok_or_else(|| anyhow!("not an object!"))?, None => { - bail!("{request_id}: no groups in metadata!") + bail!("no groups in metadata!") } }, None => { - bail!("{request_id}: this organisation as no metadata!") + bail!("this organisation as no metadata!") } }; let mut default_group_id = String::new(); info!("recuparating default group"); for (id, data) in groups { println!("data: {}", data); - let name = data - .pointer("/name") - .ok_or_else(|| anyhow!("{request_id}: name not present or in the wrong place"))? - .as_str() - .ok_or_else(|| anyhow!("{request_id}: name not a string!"))?; + let name = data.as_str().ok_or_else(|| anyhow!("name not a string!"))?; if name == "default" { default_group_id = id.to_owned(); } @@ -118,7 +87,7 @@ pub async fn sync_groups( info!("sending payload to iam!"); for (user, role) in users { info!("patching user: {user}."); - send_to_iam(&config, &default_group_id, user, role, request_id, "user").await?; + send_to_iam(&config, &default_group_id, user, role, "user").await?; } Ok(()) } @@ -126,80 +95,44 @@ pub async fn sync_groups( pub async fn sync_user( config: Arc, identity: Identity, - request_id: String, + correlation_id: String, mode: SyncMode, ) { - let kafka_error = get_producer(&config, "error", &request_id); - let kafka_notif = get_producer(&config, "notif", &request_id); - match sync(config, identity, &request_id, mode).await { + match sync(&config, identity, mode).await { Ok(_) => { - let message = KafkaMessage { - payload: "ok".to_string(), - key: None, - headers: None, - }; - if let Err(e) = kafka_notif - .produce(message, Some(Duration::from_secs(30))) - .await - { - let message = KafkaMessage { - payload: e.to_string(), - key: None, - headers: None, - }; - if let Err(e) = kafka_error - .produce(message, Some(Duration::from_secs(30))) - .await + if let Err(e) = send_to_kafka(&config.kafka, "notif", "ok".to_string(), None).await { + if let Err(e) = send_error(&config.kafka, "error", e.deref(), &correlation_id).await { - error!("{request_id}: {e}"); - panic!(); + error!("{e}"); + return; } } info!("data synced successfully!"); } Err(e) => { error!("an error has occurred when syncing data: {e}"); - let message = KafkaMessage { - payload: e.to_string(), - key: None, - headers: None, - }; - let res = kafka_error - .produce(message, Some(Duration::from_secs(30))) - .await; - let message = KafkaMessage { - payload: "ko".to_string(), - key: None, - headers: None, - }; - if let Err(e) = kafka_notif - .produce(message, Some(Duration::from_secs(30))) - .await - { - error!("{request_id}: {e}"); - panic!(); + let res = send_error(&config.kafka, "error", e.deref(), &correlation_id).await; + if let Err(e) = send_to_kafka(&config.kafka, "notif", "ko", None).await { + error!("{e}"); } if let Err(e) = res { - error!("{request_id}: {e}"); - panic!(); + error!("{e}"); } } } } - async fn send_to_iam( config: &Arc, id: &str, ressource_id: &str, json: &serde_json::Value, - request_id: &str, perm_type: &str, ) -> Result<()> { let mut iam_client = config .iam .client .clone() - .ok_or_else(|| anyhow!("{request_id}: Iam client not initialized!"))?; + .ok_or_else(|| anyhow!("Iam client not initialized!"))?; let mut input = Input { id: id.to_owned(), perm_type: perm_type.to_owned(), @@ -207,7 +140,7 @@ async fn send_to_iam( value: serde_json::to_string(&json).unwrap(), ..Default::default() }; - let mode = match &config.mode as &str { + let mode = match &config.opa.mode as &str { "admin" => Mode::Admin, "public" => Mode::Public, "trait" => Mode::Trait, @@ -220,13 +153,12 @@ async fn send_to_iam( } pub async fn sync( - config: Arc, + config: &Arc, mut identity: Identity, - request_id: &str, mode: SyncMode, ) -> Result<()> { let id = identity.id.clone(); - let meta = match &config.mode as &str { + let meta = match &config.opa.mode as &str { "admin" => &mut identity.metadata_admin, "public" => &mut identity.metadata_public, "trait" => &mut identity.traits, @@ -234,27 +166,39 @@ pub async fn sync( }; let mut projects = match meta { Some(ref mut meta) => match meta.get_mut("project") { - Some(proj) => { - let old_projects = proj - .as_object() - .ok_or_else(|| anyhow!("{request_id}: not an object"))?; - old_projects + Some(proj) => match proj.as_object() { + Some(old_projects) => old_projects .keys() .map(|e| e.as_str().to_owned()) - .collect::>() - } + .collect::>(), + None => { + let mut ret = Vec::new(); + let old_projects = proj + .as_array() + .ok_or_else(|| anyhow!("not an object or an array!"))?; + for project in old_projects.iter() { + ret.push( + project + .as_u64() + .ok_or_else(|| anyhow!("not a number"))? + .to_string(), + ) + } + ret + } + }, None => Vec::new(), }, None => { - bail!("{request_id}: this group as no metadata!"); + bail!("this group as no metadata!"); } }; let name = match identity.traits { Some(ref mut traits) => traits .get_mut("name") - .ok_or_else(|| anyhow!("{request_id}: this group as no name!"))? + .ok_or_else(|| anyhow!("this group as no name!"))? .take(), - None => bail!("{request_id}: this group as no trait!"), + None => bail!("this group as no trait!"), }; info!("old project: {projects:?}"); info!("sync mode: {mode:?}"); @@ -265,7 +209,7 @@ pub async fn sync( projects.push(new_project); } } - let users = extract_sync_id(&mut identity, request_id, "user", &config).await?; + let users = extract_sync_id(&mut identity, "user", config).await?; for (user, role) in users { let json = json!({ "name": name, @@ -274,7 +218,7 @@ pub async fn sync( }); info!("new project list: {json}"); info!("patching user: {user}."); - send_to_iam(&config, &user, &id, &json, request_id, "group").await?; + send_to_iam(config, &user, &id, &json, "group").await?; } } SyncMode::User(data) => { @@ -284,7 +228,7 @@ pub async fn sync( "project": projects, "role": role }); - send_to_iam(&config, &user, &id, &json, request_id, "group").await?; + send_to_iam(config, &user, &id, &json, "group").await?; } } }; @@ -306,10 +250,9 @@ mod test_sync { let json = Value::Array(vec![Value::String("admin".to_owned())]); let user = Uuid::new_v4().to_string(); let id = Uuid::new_v4().to_string(); - let uuid = "1"; let config = configure(None, None, None).await; let config = Arc::new(config); - send_to_iam(&config, &user, &id, &json, uuid, "groups") + send_to_iam(&config, &user, &id, &json, "groups") .await .unwrap(); } @@ -317,20 +260,18 @@ mod test_sync { #[tokio::test] async fn test_sync_simple() { let identity = serde_json::from_str(IDENTITY_GROUP).unwrap(); - let uuid = "1"; let mode = SyncMode::Project(vec!["test".to_owned(), "test".to_owned()]); let config = configure(None, None, None).await; let config = Arc::new(config); - sync(config, identity, uuid, mode).await.unwrap(); + sync(&config, identity, mode).await.unwrap(); } #[tokio::test] async fn test_sync_groups_simple() { let identity = serde_json::from_str(IDENTITY_ORG).unwrap(); - let uuid = "1"; let user = &[("test".to_owned(), Value::Null)]; let config = configure(None, None, None).await; let config = Arc::new(config); - sync_groups(config, &identity, uuid, user).await.unwrap(); + sync_groups(config, &identity, user).await.unwrap(); } } diff --git a/src/controller/update.rs b/src/controller/update.rs index 6c579a6..c148fd2 100644 --- a/src/controller/update.rs +++ b/src/controller/update.rs @@ -9,59 +9,47 @@ use tokio::task::JoinSet; use tonic::Request; use tracing::{debug, info}; +#[cfg(feature = "opa")] +use crate::utils::opa::validate_roles; use crate::{ config::SiriusConfig, permission::{Input, Mode}, router::{Data, IDType}, - utils::opa::validate_roles, }; ///get an identities form kratos by mail -async fn get_identity_by_mail( - client: &Configuration, - id: &str, - request_id: &str, -) -> Result { +async fn get_identity_by_mail(client: &Configuration, id: &str) -> Result { let mut addr = format!("{}/admin/identities", client.base_path); addr = addr + "?credentials_identifier=" + id; let response = client.client.get(addr).send().await?; response.error_for_status_ref()?; let json = response.json::>().await?; - let identity = match json.get(0) { + let identity = match json.first() { Some(identity) => identity.to_owned(), - None => bail!("{request_id}: no identity found for {}", id), + None => bail!("no identity found for {}", id), }; debug!("{:?}", identity); Ok(identity) } -async fn get_kratos_identity( - config: &SiriusConfig, - id: &IDType, - request_id: &str, -) -> Result { +async fn get_kratos_identity(config: &SiriusConfig, id: &IDType) -> Result { let client = match &config.kratos.client { Some(client) => client, - None => bail!("{request_id}: kratos client not initialized"), + None => bail!("kratos client not initialized"), }; let identity = match id { - IDType::Email(id) => get_identity_by_mail(client, id.as_str(), request_id).await?, + IDType::Email(id) => get_identity_by_mail(client, id.as_str()).await?, IDType::ID(ref id) => get_identity(client, &id.to_string(), None).await?, }; Ok(identity) } -async fn send_to_iam( - identity: Arc, - config: Arc, - data: Data, - request_id: String, -) -> Result<()> { +async fn send_to_iam(identity: Arc, config: Arc, data: Data) -> Result<()> { let mut client = config .iam .client .clone() - .ok_or_else(|| anyhow!("{request_id}: Iam client not initialized!"))?; + .ok_or_else(|| anyhow!(" Iam client not initialized!"))?; let value = data.value.to_string(); info!("{value}"); @@ -72,7 +60,7 @@ async fn send_to_iam( value, ..Default::default() }; - let mode = match &config.mode as &str { + let mode = match &config.opa.mode as &str { "admin" => Mode::Admin, "public" => Mode::Public, "trait" => Mode::Trait, @@ -88,57 +76,45 @@ async fn send_to_iam( pub async fn update_controller( config: Arc, payload: Vec, - request_id: &str, - identity: Identity, + _identity: Identity, endpoint: &str, ) -> Result { let mut handles = JoinSet::new(); let mut object_identity: Option> = None; - let uri = "api/iam/".to_owned() + endpoint; + let _uri = "api/iam/".to_owned() + endpoint; for data in payload.iter() { #[cfg(feature = "opa")] - if !validate_roles(&config, &identity, &data.ressource_id, request_id, &uri).await? { + if !validate_roles(&config, &_identity, &data.ressource_id, &_uri).await? { Err(anyhow!("Invalid role!"))?; } println!("role validated!"); if let Some(ref ident) = object_identity { match data.id { IDType::ID(id) if id.to_string() != ident.id => { - object_identity = Some(Arc::new( - get_kratos_identity(&config, &data.id, request_id).await?, - )) + object_identity = Some(Arc::new(get_kratos_identity(&config, &data.id).await?)) } IDType::Email(ref id) => match &ident.traits { Some(traits) => match traits.get("email") { Some(email) if email == id.as_str() => (), _ => { - object_identity = Some(Arc::new( - get_kratos_identity(&config, &data.id, request_id).await?, - )) + object_identity = + Some(Arc::new(get_kratos_identity(&config, &data.id).await?)) } }, None => { - object_identity = Some(Arc::new( - get_kratos_identity(&config, &data.id, request_id).await?, - )) + object_identity = + Some(Arc::new(get_kratos_identity(&config, &data.id).await?)) } }, _ => (), } } else { - object_identity = Some(Arc::new( - get_kratos_identity(&config, &data.id, request_id).await?, - )); + object_identity = Some(Arc::new(get_kratos_identity(&config, &data.id).await?)); } info!("kratos identity obtained!"); match object_identity { Some(ref ident) => { - handles.spawn(send_to_iam( - ident.clone(), - config.clone(), - data.to_owned(), - request_id.to_owned(), - )); + handles.spawn(send_to_iam(ident.clone(), config.clone(), data.to_owned())); } None => bail!("the identity is not initialized this should not be happening!"), } @@ -146,8 +122,8 @@ pub async fn update_controller( while let Some(future) = handles.join_next().await { future??; } - let ret = Arc::try_unwrap(object_identity.unwrap()) - .map_err(|_| anyhow!("{request_id}: failed to uwrap arc"))?; + let ret = + Arc::try_unwrap(object_identity.unwrap()).map_err(|_| anyhow!("failed to uwrap arc"))?; Ok(ret) } @@ -166,7 +142,6 @@ pub mod test_controler { #[tokio::test] async fn test_get_kratos_identity_email() { let id = IDType::Email(Email::from_str("lol.lol@lol.io").unwrap()); - let uuid = "1"; let mut kratos_server = MockServer::new_async().await; let config = configure(Some(&kratos_server), None, None).await; let body = "[".to_owned() + IDENTITY_USER + "]"; @@ -180,7 +155,7 @@ pub mod test_controler { .with_body(body) .create_async() .await; - get_kratos_identity(&config, &id, uuid).await.unwrap(); + get_kratos_identity(&config, &id).await.unwrap(); mock_kratos.assert_async().await; } @@ -192,11 +167,10 @@ pub mod test_controler { ressource_id: "222".to_owned(), value: Value::Array(vec![Value::String("admin".to_owned())]), }; - let uuid = "1".to_owned(); let identity = Arc::new(serde_json::from_str(IDENTITY_USER).unwrap()); let config = configure(None, None, None).await; let config = Arc::new(config); - send_to_iam(identity, config, data, uuid).await.unwrap(); + send_to_iam(identity, config, data).await.unwrap(); } #[tokio::test] @@ -207,9 +181,8 @@ pub mod test_controler { ressource_id: "222".to_owned(), value: Value::Array(vec![Value::String("admin".to_owned())]), }; - let uuid = "1"; let mut kratos_server = MockServer::new_async().await; - let mut opa_server = MockServer::new_async().await; + let opa_server = MockServer::new_async().await; let config = configure(Some(&kratos_server), Some(&opa_server), None).await; let body = "[".to_owned() + IDENTITY_USER + "]"; let kratos_mock = kratos_server @@ -230,7 +203,7 @@ pub mod test_controler { .create_async() .await; */ let identity = serde_json::from_str(IDENTITY_USER).unwrap(); - update_controller(Arc::new(config), vec![data], uuid, identity, "project") + update_controller(Arc::new(config), vec![data], identity, "project") .await .unwrap(); kratos_mock.assert_async().await; @@ -245,9 +218,8 @@ pub mod test_controler { ressource_id: "222".to_owned(), value: Value::String("admin".to_owned()), }; - let uuid = "1"; let mut kratos_server = MockServer::new_async().await; - let mut opa_server = MockServer::new_async().await; + let opa_server = MockServer::new_async().await; let config = configure(Some(&kratos_server), Some(&opa_server), None).await; let body = "[".to_owned() + IDENTITY_USER + "]"; let kratos_mock = kratos_server @@ -273,7 +245,6 @@ pub mod test_controler { update_controller( Arc::new(config), vec![data.clone(), data], - uuid, identity, "project", ) diff --git a/src/handelers.rs b/src/handelers.rs index eb94efa..cd33c65 100644 --- a/src/handelers.rs +++ b/src/handelers.rs @@ -1,11 +1,11 @@ use axum::http::{StatusCode, Uri}; +use stream_cancel::{Trigger, Tripwire}; use tokio::signal; -use tracing::error; -use tracing::info; +use tracing::{error, info}; #[cfg(not(tarpaulin_include))] ///handle the shutdown signal -pub async fn shutdown_signal() { +pub async fn shutdown_signal_trigger(trigger: Trigger) { let ctrl_c = async { signal::ctrl_c() .await @@ -29,6 +29,13 @@ pub async fn shutdown_signal() { } info!("signal received, starting graceful shutdown"); + drop(trigger); +} + +#[cfg(not(tarpaulin_include))] +///handle the shutdown signal +pub async fn shutdown_signal(shutdown: Tripwire) { + shutdown.await; } #[cfg(not(tarpaulin_include))] diff --git a/src/main.rs b/src/main.rs index a4029e5..cfa6616 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,14 +1,22 @@ -use std::sync::Arc; +use std::{ + future::{Future, IntoFuture}, + sync::Arc, +}; use anyhow::Result; use axum::{ + http::HeaderName, routing::{get, post}, - Router, Server, + serve, Router, }; - -use tokio::{sync::RwLock, task::JoinHandle}; -use tower_http::request_id::{MakeRequestUuid, SetRequestIdLayer}; -use tracing::{info, warn}; +use stream_cancel::Tripwire; +use tokio::{net::TcpListener, sync::RwLock, task::JoinHandle}; +use tower_http::{ + request_id::{MakeRequestUuid, SetRequestIdLayer}, + trace::{DefaultMakeSpan, DefaultOnRequest, DefaultOnResponse, TraceLayer}, + LatencyUnit, +}; +use tracing::{info, warn, Level}; use tracing_subscriber::{fmt, EnvFilter}; use rs_utils::config::{init_watcher, Config}; @@ -19,10 +27,10 @@ pub mod permission { mod controller; mod handelers; -use handelers::{fallback, shutdown_signal}; +use handelers::{fallback, shutdown_signal, shutdown_signal_trigger}; mod router; use router::{ - alive, list_groups, list_projects, ready, update_groups, update_organisaion, update_projects, + alive, list_groups, list_projects, ready, update_groups, update_organisation, update_projects, }; mod config; use config::{SiriusConfig, CONFIG_FALLBACK}; @@ -40,13 +48,26 @@ pub fn app(shared_state: ConfigState) -> Router { let api_route = Router::new() .route("/project", post(update_projects).get(list_projects)) .route("/group", post(update_groups).get(list_groups)) - .route("/organisation", post(update_organisaion).get(list_orga)); + .route("/organisation", post(update_organisation).get(list_orga)); Router::new() .nest("/api/iam", api_route) .with_state(shared_state) .fallback(fallback) - .layer(SetRequestIdLayer::x_request_id(MakeRequestUuid)) + .layer(SetRequestIdLayer::new( + HeaderName::from_static("correlation_id"), + MakeRequestUuid, + )) + .layer( + TraceLayer::new_for_http() + .make_span_with(DefaultMakeSpan::new().include_headers(true)) + .on_request(DefaultOnRequest::new().level(Level::INFO)) + .on_response( + DefaultOnResponse::new() + .level(Level::INFO) + .latency_unit(LatencyUnit::Micros), + ), + ) } ///heatlh router config @@ -60,19 +81,22 @@ pub fn health(shared_state: ConfigState) -> Router { } ///launch http router -async fn make_http( +async fn make_http( shared_state: ConfigState, f: fn(ConfigState) -> Router, addr: String, -) -> JoinHandle> { - //todo: add path for tlscertificate - let handle = tokio::spawn( - Server::bind(&addr.parse().unwrap()) - .serve(f(shared_state).into_make_service()) - .with_graceful_shutdown(shutdown_signal()), - ); + signal: T, +) -> JoinHandle> +where + T: Future + std::marker::Send + 'static, +{ + info!("listening on {}", addr); + let listener = TcpListener::bind(&addr).await.unwrap(); + let service = serve(listener, f(shared_state)) + .with_graceful_shutdown(signal) + .into_future(); info!("lauching http server on: {addr}"); - handle + tokio::spawn(service) } #[cfg(not(tarpaulin_include))] @@ -91,13 +115,14 @@ async fn main() -> Result<()> { let service = config.service.clone(); let shared_state = Arc::new(RwLock::new(config)); tokio::spawn(init_watcher(config_path, shared_state.clone(), None)); - + let (trigger, shutdown) = Tripwire::new(); + let signal_sender = shutdown_signal_trigger(trigger); info!("statrting http router"); let http_addr = service.addr.clone() + ":" + &service.ports.main as &str; - let http = make_http(shared_state.clone(), app, http_addr).await; - + let http = make_http(shared_state.clone(), app, http_addr, signal_sender).await; + let signal_receiver = shutdown_signal(shutdown); let health_addr = service.addr.clone() + ":" + &service.ports.health as &str; - let health = make_http(shared_state.clone(), health, health_addr).await; + let health = make_http(shared_state.clone(), health, health_addr, signal_receiver).await; let (http_critical, health_critical) = tokio::try_join!(http, health)?; http_critical?; health_critical?; diff --git a/src/router.rs b/src/router.rs index 2a86299..a5d66c5 100644 --- a/src/router.rs +++ b/src/router.rs @@ -1,13 +1,12 @@ use std::{fmt::Display, sync::Arc}; use anyhow::anyhow; -use axum::{extract::State, http::StatusCode, response::Result, Extension, Json}; +use axum::{extract::State, http::HeaderMap, http::StatusCode, response::Result, Json}; use axum_extra::extract::cookie::CookieJar; use serde::Deserialize; use serde_email::Email; use serde_json::Value; use tokio::sync::RwLock; -use tower_http::request_id::RequestId; use tracing::{error, info}; use uuid::Uuid; @@ -19,9 +18,10 @@ use crate::{ update::update_controller, }, error::RouterError, + utils::error::send_error, }; -#[derive(Deserialize, Clone)] +#[derive(Deserialize, Clone, Debug)] #[serde(untagged)] pub enum IDType { ID(Uuid), @@ -37,7 +37,7 @@ impl Display for IDType { } } -#[derive(Deserialize, Clone)] +#[derive(Deserialize, Clone, Debug)] pub struct Data { //id :can be the email or the uuid depending of the endpoint pub id: IDType, @@ -47,20 +47,15 @@ pub struct Data { pub value: Value, } -pub async fn update_organisaion( - State(config): State>>, - request_id: Extension, +async fn update_organisation_handler( + config: Arc, cookies: CookieJar, - Json(payload): Json>, -) -> Result<&'static str, RouterError> { - info!("new request!"); - let request_id = request_id.header_value().to_str()?; - let config = config.read().await.clone(); - let config = Arc::new(config); + payload: Vec, +) -> Result<(), RouterError> { let kratos_cookie = match cookies.get("ory_kratos_session") { Some(cookie) => cookie, None => { - error!("{request_id}: kratos cookie not found"); + error!("Kratos cookie not found"); return Err(RouterError::Status(StatusCode::UNAUTHORIZED)); } }; @@ -76,38 +71,48 @@ pub async fn update_organisaion( users.push((data.ressource_id.to_owned(), data.value.clone())); } } - let identity = update_controller( - config.clone(), - payload, - request_id, - identity, - "organisation", - ) - .await?; + let identity = update_controller(config.clone(), payload, identity, "organisation").await?; if !users.is_empty() { - println!("updating group!"); - sync_groups(config.clone(), &identity, request_id, &users).await?; + info!("updating group!"); + sync_groups(config.clone(), &identity, &users).await?; let mode = SyncMode::User(users); - println!("updating user!"); - sync(config, identity, request_id, mode).await?; + info!("updating user!"); + sync(&config, identity, mode).await?; } - Ok("200") + Ok(()) } - -pub async fn update_groups( +#[tracing::instrument] +#[axum_macros::debug_handler] +pub async fn update_organisation( State(config): State>>, - request_id: Extension, + headers: HeaderMap, cookies: CookieJar, Json(payload): Json>, ) -> Result<&'static str, RouterError> { info!("new request!"); - let request_id = request_id.header_value().to_str()?.to_owned(); + let correlation_id = headers + .get("correlation_id") + .ok_or_else(|| anyhow!("the request as no correlation id!"))? + .to_str()?; let config = config.read().await.clone(); let config = Arc::new(config); + if let Err(e) = update_organisation_handler(config.clone(), cookies, payload).await { + send_error(&config.kafka, "error", &e, correlation_id).await?; + return Err(e); + } + Ok("200") +} + +async fn update_groups_handler( + config: Arc, + cookies: CookieJar, + payload: Vec, + correlation_id: &str, +) -> Result<(), RouterError> { let kratos_cookie = match cookies.get("ory_kratos_session") { Some(cookie) => cookie, None => { - error!("{request_id}: kratos cookie not found"); + error!("Kratos cookie not found"); return Err(RouterError::Status(StatusCode::UNAUTHORIZED)); } }; @@ -129,7 +134,7 @@ pub async fn update_groups( } info!("users: {users:?}"); info!("project: {projects:?}"); - let group = update_controller(config.clone(), payload, &request_id, identity, "groups").await?; + let group = update_controller(config.clone(), payload, identity, "groups").await?; info!("group updated"); if !users.is_empty() { let sync_mode = SyncMode::User(users); @@ -137,32 +142,53 @@ pub async fn update_groups( tokio::spawn(sync_user( config.clone(), group.clone(), - request_id.clone(), + correlation_id.to_owned(), sync_mode, )); } if !projects.is_empty() { let sync_mode = SyncMode::Project(projects); info!("lauching projects sync"); - tokio::spawn(sync_user(config, group, request_id.clone(), sync_mode)); + tokio::spawn(sync_user( + config, + group, + correlation_id.to_owned(), + sync_mode, + )); } - Ok("200") + Ok(()) } - -pub async fn update_projects( +#[tracing::instrument] +#[axum_macros::debug_handler] +pub async fn update_groups( State(config): State>>, - request_id: Extension, + headers: HeaderMap, cookies: CookieJar, Json(payload): Json>, ) -> Result<&'static str, RouterError> { info!("new request!"); - let request_id = request_id.header_value().to_str()?; + let correlation_id = headers + .get("correlation_id") + .ok_or_else(|| anyhow!("the request as no correlation id!"))? + .to_str()?; let config = config.read().await.clone(); let config = Arc::new(config); + if let Err(e) = update_groups_handler(config.clone(), cookies, payload, correlation_id).await { + send_error(&config.kafka, "error", &e, correlation_id).await?; + return Err(e); + } + Ok("200") +} + +async fn update_projects_handler( + config: Arc, + cookies: CookieJar, + payload: Vec, +) -> Result<(), RouterError> { let kratos_cookie = match cookies.get("ory_kratos_session") { Some(cookie) => cookie, None => { - error!("{request_id}: kratos cookie not found"); + error!("kratos cookie not found"); return Err(RouterError::Status(StatusCode::UNAUTHORIZED)); } }; @@ -172,79 +198,149 @@ pub async fn update_projects( .await .map_err(|_| RouterError::Status(StatusCode::UNAUTHORIZED))?; info!("identity validated"); - update_controller(config, payload, request_id, identity, "projects").await?; - Ok("200") + update_controller(config, payload, identity, "projects").await?; + Ok(()) } -pub async fn list_projects( +#[tracing::instrument] +#[axum_macros::debug_handler] +pub async fn update_projects( State(config): State>>, - request_id: Extension, + headers: HeaderMap, cookies: CookieJar, -) -> Result { + Json(payload): Json>, +) -> Result<&'static str, RouterError> { info!("new request!"); - let request_id = request_id.header_value().to_str()?; + let correlation_id = headers + .get("correlation_id") + .ok_or_else(|| anyhow!("the request as no correlation id!"))? + .to_str()?; + let config = config.read().await.clone(); + let config = Arc::new(config); + if let Err(e) = update_projects_handler(config.clone(), cookies, payload).await { + send_error(&config.kafka, "error", &e, correlation_id).await?; + return Err(e); + } + Ok("200") +} + +async fn list_projects_handler( + config: &SiriusConfig, + cookies: CookieJar, +) -> Result { let kratos_cookie = match cookies.get("ory_kratos_session") { Some(cookie) => cookie, None => { - error!("{request_id}: kratos cookie not found"); + error!("Kratos cookie not found"); return Err(RouterError::Status(StatusCode::UNAUTHORIZED)); } }; let identity = config.kratos.validate_session(kratos_cookie).await?; info!("identity validated"); - let data = list_project_controller(request_id, identity, config).await?; + let data = list_project_controller(identity, config).await?; let resp = serde_json::to_string(&data)?; - Ok(resp) } - -pub async fn list_groups( +#[tracing::instrument] +#[axum_macros::debug_handler] +pub async fn list_projects( State(config): State>>, - request_id: Extension, + headers: HeaderMap, cookies: CookieJar, ) -> Result { info!("new request!"); - let request_id = request_id.header_value().to_str()?; + let correlation_id = headers + .get("correlation_id") + .ok_or_else(|| anyhow!("the request as no correlation id!"))? + .to_str()?; + let config = config.read().await.clone(); + let ret = list_projects_handler(&config, cookies).await; + if let Err(ref e) = ret { + send_error(&config.kafka, "error", e, correlation_id).await?; + } + ret +} + +async fn list_groups_handler( + config: &SiriusConfig, + cookies: CookieJar, +) -> Result { let kratos_cookie = match cookies.get("ory_kratos_session") { Some(cookie) => cookie, None => { - error!("{request_id}: kratos cookie not found"); + error!("Kratos cookie not found"); return Err(RouterError::Status(StatusCode::UNAUTHORIZED)); } }; let identity = config.kratos.validate_session(kratos_cookie).await?; info!("identity validated"); - let data = list_controller(request_id, identity, "group", config).await?; + let data = list_controller(identity, "group", config).await?; let resp = serde_json::to_string(&data)?; - Ok(resp) } -pub async fn list_orga( +#[tracing::instrument] +#[axum_macros::debug_handler] +pub async fn list_groups( State(config): State>>, - request_id: Extension, + headers: HeaderMap, cookies: CookieJar, ) -> Result { info!("new request!"); - let request_id = request_id.header_value().to_str()?; + let correlation_id = headers + .get("correlation_id") + .ok_or_else(|| anyhow!("the request as no correlation id!"))? + .to_str()?; + let config = config.read().await.clone(); + let ret = list_groups_handler(&config, cookies).await; + if let Err(ref e) = ret { + send_error(&config.kafka, "error", e, correlation_id).await?; + } + ret +} + +async fn list_orga_handler( + config: &SiriusConfig, + cookies: CookieJar, +) -> Result { let kratos_cookie = match cookies.get("ory_kratos_session") { Some(cookie) => cookie, None => { - error!("{request_id}: kratos cookie not found"); + error!("Kratos cookie not found"); return Err(RouterError::Status(StatusCode::UNAUTHORIZED)); } }; let identity = config.kratos.validate_session(kratos_cookie).await?; info!("identity validated"); - let data = list_controller(request_id, identity, "organisation", config).await?; + let data = list_controller(identity, "organisation", config).await?; let resp = serde_json::to_string(&data)?; - Ok(resp) } +#[tracing::instrument] +#[axum_macros::debug_handler] +pub async fn list_orga( + State(config): State>>, + headers: HeaderMap, + cookies: CookieJar, +) -> Result { + info!("new request!"); + let correlation_id = headers + .get("correlation_id") + .ok_or_else(|| anyhow!("the request as no correlation id!"))? + .to_str()?; + + let config = config.read().await.clone(); + let ret = list_orga_handler(&config, cookies).await; + if let Err(ref e) = ret { + send_error(&config.kafka, "error", e, correlation_id).await?; + } + ret +} + pub async fn alive() -> Result<&'static str, RouterError> { Ok("200") } @@ -334,7 +430,7 @@ mod http_router_test { #[tokio::test] async fn test_update_users() { let mut kratos_server = Server::new_async().await; - let mut opa_server = Server::new_async().await; + let opa_server = Server::new_async().await; let config = configure(Some(&kratos_server), Some(&opa_server), None).await; let body = "[".to_owned() + IDENTITY_USER + "]"; let session = Session::new( @@ -396,7 +492,7 @@ mod http_router_test { #[tokio::test] async fn test_update_group() { let mut kratos_server = Server::new_async().await; - let mut opa_server = Server::new_async().await; + let opa_server = Server::new_async().await; let config = configure(Some(&kratos_server), Some(&opa_server), None).await; let session = Session::new( "bonjour".to_owned(), @@ -459,7 +555,7 @@ mod http_router_test { #[tokio::test] async fn test_update_orga() { let mut kratos_server = Server::new_async().await; - let mut opa_server = Server::new_async().await; + let opa_server = Server::new_async().await; let config = configure(Some(&kratos_server), Some(&opa_server), None).await; let session = Session::new( "bonjour".to_owned(), diff --git a/src/utils/error.rs b/src/utils/error.rs new file mode 100644 index 0000000..085b90d --- /dev/null +++ b/src/utils/error.rs @@ -0,0 +1,23 @@ +use anyhow::Result; +use serde::Serialize; + +use crate::{config::Kafka, utils::kafka::send_to_kafka}; + +#[derive(Serialize)] +pub struct ErrorData<'a> { + code: &'a str, + message: String, +} + +///send error to the given kafka topic +#[cfg(not(tarpaulin_include))] +pub async fn send_error(config: &Kafka, topic: &str, data: T, correlation_id: &str) -> Result<()> +where + T: std::error::Error, +{ + let error = ErrorData { + code: "webhook_internal_error", + message: data.to_string(), + }; + send_to_kafka(config, topic, &error, Some(correlation_id)).await +} diff --git a/src/utils/kafka.rs b/src/utils/kafka.rs new file mode 100644 index 0000000..a0b9422 --- /dev/null +++ b/src/utils/kafka.rs @@ -0,0 +1,62 @@ +#[cfg(not(test))] +use std::time::Duration; + +use anyhow::Result; +#[cfg(not(test))] +use anyhow::{anyhow, bail}; +use serde::Serialize; +use std::collections::HashMap; +use tracing::info; + +use crate::config::Kafka; + +///Send data to kafka. +#[cfg(not(tarpaulin_include))] +pub async fn send_to_kafka( + _config: &Kafka, + _topic: &str, + data: T, + header: Option<&str>, +) -> Result<()> { + let header = + header.map(|header| HashMap::from([("correlation_id".to_owned(), header.to_owned())])); + let _message = kafka::KafkaMessage { + headers: header, + key: None, + payload: serde_json::to_string(&data)?, + }; + #[cfg(not(test))] + match &_config.producers.clients { + Some(clients) => { + clients + .get(_topic) + .ok_or_else(|| anyhow!("failed to get asked kafka topic!"))? + .produce(_message, Some(Duration::from_secs(30))) + .await? + } + None => bail!("topic not found"), + } + info!("data successfully sent"); + Ok(()) +} + +#[cfg(test)] +mod test_kafka { + use std::collections::HashMap; + + use rs_utils::config::Config; + + use super::*; + use crate::config::SiriusConfig; + + #[tokio::test] + async fn test_send_to_kafka() { + let map = HashMap::from([("examples".to_owned(), 42)]); + let config = SiriusConfig::new("tests/config.toml").await; + assert!( + send_to_kafka(&config.kafka, "examples", &map, Some("bonjour")) + .await + .is_ok() + ); + } +} diff --git a/src/utils/mod.rs b/src/utils/mod.rs index ca01cfa..dca7352 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,3 +1,6 @@ +pub mod error; +pub mod kafka; +#[cfg(feature = "opa")] pub mod opa; #[cfg(test)] pub mod test; diff --git a/src/utils/opa.rs b/src/utils/opa.rs index 564439b..5ed9009 100644 --- a/src/utils/opa.rs +++ b/src/utils/opa.rs @@ -43,7 +43,7 @@ pub async fn validate_roles( let res = client .client - .post(&config.opa) + .post(&config.opa.addr) .header("correlation_id", request_id) .json(&opa) .send() diff --git a/src/utils/test.rs b/src/utils/test.rs index 174372d..2bebfb8 100644 --- a/src/utils/test.rs +++ b/src/utils/test.rs @@ -219,8 +219,8 @@ pub async fn configure( }; kratos.update(); let mut conf = SiriusConfig::default(); - conf.mode = "public".to_owned(); - conf.opa = match opa { + conf.opa.mode = "public".to_owned(); + conf.opa.addr = match opa { Some(opa) => opa.url(), None => "http://0.0.0.0:8000".to_owned(), }; diff --git a/test/config.toml b/tests/config.toml similarity index 60% rename from test/config.toml rename to tests/config.toml index 09a0db4..194effd 100644 --- a/test/config.toml +++ b/tests/config.toml @@ -1,5 +1,6 @@ +[opa] mode = "public" -opa = "http://127.0.0.1:8000" +addr = "http://127.0.0.1:8000" [kratos] addr = "http://localhost:4434" @@ -14,8 +15,6 @@ addr = "127.0.0.1" ports.main = "5050" ports.health = "1040" -[kafka.producers] -notif.broker = "test" -notif.topic = "notif" -error.broker = "test" -error.topic = "error" +[kafka] +broker = "test" +producers.topics = ["notif", "error"] From 9fa9ddb63c724c60fd9e5b56af810b7307361863 Mon Sep 17 00:00:00 2001 From: Nicolas Haquet Date: Mon, 19 Feb 2024 16:26:46 +0100 Subject: [PATCH 3/3] [UPDATE] dep + dockerfile --- Cargo.lock | 66 +++++++++++++++++++++++++++--------------------------- Dockerfile | 2 +- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 783afd6..71818e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -39,9 +39,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" [[package]] name = "arc-swap" @@ -78,7 +78,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -89,7 +89,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -284,7 +284,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -343,9 +343,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" [[package]] name = "bytemuck" @@ -508,7 +508,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -721,7 +721,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1267,7 +1267,7 @@ checksum = "afc95a651c82daf7004c824405aa1019723644950d488571bd718e3ed84646ed" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1504,7 +1504,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1608,7 +1608,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1644,7 +1644,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1684,7 +1684,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1714,7 +1714,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "version_check", "yansi", ] @@ -1746,7 +1746,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.48", + "syn 2.0.49", "tempfile", "which", ] @@ -1761,7 +1761,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1914,7 +1914,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2053,7 +2053,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 2.0.48", + "syn 2.0.49", "unicode-xid", "version_check", ] @@ -2200,9 +2200,9 @@ checksum = "22a197350ece202f19a166d1ad6d9d6de145e1d2a8ef47db299abe164dbd7530" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "same-file" @@ -2284,7 +2284,7 @@ checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2510,9 +2510,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" dependencies = [ "proc-macro2", "quote", @@ -2575,7 +2575,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2671,7 +2671,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2729,7 +2729,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.5", + "toml_edit 0.22.6", ] [[package]] @@ -2754,9 +2754,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.5" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e68c159e8f5ba8a28c4eb7b0c0c190d77bb479047ca713270048145a9ad28a" +checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" dependencies = [ "indexmap 2.2.3", "serde", @@ -2802,7 +2802,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2875,7 +2875,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3069,7 +3069,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-shared", ] @@ -3103,7 +3103,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/Dockerfile b/Dockerfile index 9370079..148d5d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.73-bullseye AS build +FROM rust:1.75-bullseye AS build ARG JOB_TOKEN ARG JOB_USER ENV CARGO_NET_GIT_FETCH_WITH_CLI true