├── .cargo └── config ├── .dockerignore ├── .env.sample ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── Dockerfile ├── LICENSE ├── README.md ├── migrations └── 20221106201421_initial.sql ├── rustfmt.toml ├── src ├── cli.rs ├── config.rs ├── database.rs ├── error.rs ├── http.rs ├── lib.rs ├── main.rs └── state.rs └── xtask ├── Cargo.toml └── src └── main.rs /.cargo/config: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run --manifest-path ./xtask/Cargo.toml --" -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | /target -------------------------------------------------------------------------------- /.env.sample: -------------------------------------------------------------------------------- 1 | DATABASE_URL="postgresql://postgres:password@localhost:5432/template-web-service" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | config.yaml 3 | .env -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "ahash" 7 | version = "0.7.6" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" 10 | dependencies = [ 11 | "getrandom", 12 | "once_cell", 13 | "version_check", 14 | ] 15 | 16 | [[package]] 17 | name = "android_system_properties" 18 | version = "0.1.5" 19 | source = "registry+https://github.com/rust-lang/crates.io-index" 20 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 21 | dependencies = [ 22 | "libc", 23 | ] 24 | 25 | [[package]] 26 | name = "anyhow" 27 | version = "1.0.66" 28 | source = "registry+https://github.com/rust-lang/crates.io-index" 29 | checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" 30 | 31 | [[package]] 32 | name = "async-trait" 33 | version = "0.1.58" 34 | source = "registry+https://github.com/rust-lang/crates.io-index" 35 | checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" 36 | dependencies = [ 37 | "proc-macro2", 38 | "quote", 39 | "syn", 40 | ] 41 | 42 | [[package]] 43 | name = "atoi" 44 | version = "1.0.0" 45 | source = "registry+https://github.com/rust-lang/crates.io-index" 46 | checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e" 47 | dependencies = [ 48 | "num-traits", 49 | ] 50 | 51 | [[package]] 52 | name = "atty" 53 | version = "0.2.14" 54 | source = "registry+https://github.com/rust-lang/crates.io-index" 55 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 56 | dependencies = [ 57 | "hermit-abi", 58 | "libc", 59 | "winapi", 60 | ] 61 | 62 | [[package]] 63 | name = "autocfg" 64 | version = "1.1.0" 65 | source = "registry+https://github.com/rust-lang/crates.io-index" 66 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 67 | 68 | [[package]] 69 | name = "axum" 70 | version = "0.6.1" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | checksum = "08b108ad2665fa3f6e6a517c3d80ec3e77d224c47d605167aefaa5d7ef97fa48" 73 | dependencies = [ 74 | "async-trait", 75 | "axum-core", 76 | "bitflags", 77 | "bytes", 78 | "futures-util", 79 | "http", 80 | "http-body", 81 | "hyper", 82 | "itoa", 83 | "matchit", 84 | "memchr", 85 | "mime", 86 | "percent-encoding", 87 | "pin-project-lite", 88 | "rustversion", 89 | "serde", 90 | "serde_json", 91 | "serde_path_to_error", 92 | "serde_urlencoded", 93 | "sync_wrapper", 94 | "tokio", 95 | "tower", 96 | "tower-http", 97 | "tower-layer", 98 | "tower-service", 99 | ] 100 | 101 | [[package]] 102 | name = "axum-core" 103 | version = "0.3.0" 104 | source = "registry+https://github.com/rust-lang/crates.io-index" 105 | checksum = "79b8558f5a0581152dc94dcd289132a1d377494bdeafcd41869b3258e3e2ad92" 106 | dependencies = [ 107 | "async-trait", 108 | "bytes", 109 | "futures-util", 110 | "http", 111 | "http-body", 112 | "mime", 113 | "rustversion", 114 | "tower-layer", 115 | "tower-service", 116 | ] 117 | 118 | [[package]] 119 | name = "base64" 120 | version = "0.13.1" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" 123 | 124 | [[package]] 125 | name = "bitflags" 126 | version = "1.3.2" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 129 | 130 | [[package]] 131 | name = "block-buffer" 132 | version = "0.10.3" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" 135 | dependencies = [ 136 | "generic-array", 137 | ] 138 | 139 | [[package]] 140 | name = "bumpalo" 141 | version = "3.11.1" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" 144 | 145 | [[package]] 146 | name = "byteorder" 147 | version = "1.4.3" 148 | source = "registry+https://github.com/rust-lang/crates.io-index" 149 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 150 | 151 | [[package]] 152 | name = "bytes" 153 | version = "1.2.1" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" 156 | 157 | [[package]] 158 | name = "cc" 159 | version = "1.0.76" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" 162 | 163 | [[package]] 164 | name = "cfg-if" 165 | version = "1.0.0" 166 | source = "registry+https://github.com/rust-lang/crates.io-index" 167 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 168 | 169 | [[package]] 170 | name = "chrono" 171 | version = "0.4.23" 172 | source = "registry+https://github.com/rust-lang/crates.io-index" 173 | checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" 174 | dependencies = [ 175 | "iana-time-zone", 176 | "num-integer", 177 | "num-traits", 178 | "serde", 179 | "winapi", 180 | ] 181 | 182 | [[package]] 183 | name = "clap" 184 | version = "4.0.23" 185 | source = "registry+https://github.com/rust-lang/crates.io-index" 186 | checksum = "0eb41c13df48950b20eb4cd0eefa618819469df1bffc49d11e8487c4ba0037e5" 187 | dependencies = [ 188 | "atty", 189 | "bitflags", 190 | "clap_derive", 191 | "clap_lex", 192 | "once_cell", 193 | "strsim", 194 | "termcolor", 195 | ] 196 | 197 | [[package]] 198 | name = "clap_derive" 199 | version = "4.0.21" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" 202 | dependencies = [ 203 | "heck", 204 | "proc-macro-error", 205 | "proc-macro2", 206 | "quote", 207 | "syn", 208 | ] 209 | 210 | [[package]] 211 | name = "clap_lex" 212 | version = "0.3.0" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" 215 | dependencies = [ 216 | "os_str_bytes", 217 | ] 218 | 219 | [[package]] 220 | name = "codespan-reporting" 221 | version = "0.11.1" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" 224 | dependencies = [ 225 | "termcolor", 226 | "unicode-width", 227 | ] 228 | 229 | [[package]] 230 | name = "core-foundation" 231 | version = "0.9.3" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" 234 | dependencies = [ 235 | "core-foundation-sys", 236 | "libc", 237 | ] 238 | 239 | [[package]] 240 | name = "core-foundation-sys" 241 | version = "0.8.3" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 244 | 245 | [[package]] 246 | name = "cpufeatures" 247 | version = "0.2.5" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" 250 | dependencies = [ 251 | "libc", 252 | ] 253 | 254 | [[package]] 255 | name = "crc" 256 | version = "3.0.0" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "53757d12b596c16c78b83458d732a5d1a17ab3f53f2f7412f6fb57cc8a140ab3" 259 | dependencies = [ 260 | "crc-catalog", 261 | ] 262 | 263 | [[package]] 264 | name = "crc-catalog" 265 | version = "2.1.0" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "2d0165d2900ae6778e36e80bbc4da3b5eefccee9ba939761f9c2882a5d9af3ff" 268 | 269 | [[package]] 270 | name = "crossbeam-queue" 271 | version = "0.3.6" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7" 274 | dependencies = [ 275 | "cfg-if", 276 | "crossbeam-utils", 277 | ] 278 | 279 | [[package]] 280 | name = "crossbeam-utils" 281 | version = "0.8.12" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" 284 | dependencies = [ 285 | "cfg-if", 286 | ] 287 | 288 | [[package]] 289 | name = "crypto-common" 290 | version = "0.1.6" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 293 | dependencies = [ 294 | "generic-array", 295 | "typenum", 296 | ] 297 | 298 | [[package]] 299 | name = "cxx" 300 | version = "1.0.81" 301 | source = "registry+https://github.com/rust-lang/crates.io-index" 302 | checksum = "97abf9f0eca9e52b7f81b945524e76710e6cb2366aead23b7d4fbf72e281f888" 303 | dependencies = [ 304 | "cc", 305 | "cxxbridge-flags", 306 | "cxxbridge-macro", 307 | "link-cplusplus", 308 | ] 309 | 310 | [[package]] 311 | name = "cxx-build" 312 | version = "1.0.81" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "7cc32cc5fea1d894b77d269ddb9f192110069a8a9c1f1d441195fba90553dea3" 315 | dependencies = [ 316 | "cc", 317 | "codespan-reporting", 318 | "once_cell", 319 | "proc-macro2", 320 | "quote", 321 | "scratch", 322 | "syn", 323 | ] 324 | 325 | [[package]] 326 | name = "cxxbridge-flags" 327 | version = "1.0.81" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | checksum = "8ca220e4794c934dc6b1207c3b42856ad4c302f2df1712e9f8d2eec5afaacf1f" 330 | 331 | [[package]] 332 | name = "cxxbridge-macro" 333 | version = "1.0.81" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | checksum = "b846f081361125bfc8dc9d3940c84e1fd83ba54bbca7b17cd29483c828be0704" 336 | dependencies = [ 337 | "proc-macro2", 338 | "quote", 339 | "syn", 340 | ] 341 | 342 | [[package]] 343 | name = "darling" 344 | version = "0.14.2" 345 | source = "registry+https://github.com/rust-lang/crates.io-index" 346 | checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" 347 | dependencies = [ 348 | "darling_core", 349 | "darling_macro", 350 | ] 351 | 352 | [[package]] 353 | name = "darling_core" 354 | version = "0.14.2" 355 | source = "registry+https://github.com/rust-lang/crates.io-index" 356 | checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" 357 | dependencies = [ 358 | "fnv", 359 | "ident_case", 360 | "proc-macro2", 361 | "quote", 362 | "strsim", 363 | "syn", 364 | ] 365 | 366 | [[package]] 367 | name = "darling_macro" 368 | version = "0.14.2" 369 | source = "registry+https://github.com/rust-lang/crates.io-index" 370 | checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" 371 | dependencies = [ 372 | "darling_core", 373 | "quote", 374 | "syn", 375 | ] 376 | 377 | [[package]] 378 | name = "digest" 379 | version = "0.10.5" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" 382 | dependencies = [ 383 | "block-buffer", 384 | "crypto-common", 385 | "subtle", 386 | ] 387 | 388 | [[package]] 389 | name = "dirs" 390 | version = "4.0.0" 391 | source = "registry+https://github.com/rust-lang/crates.io-index" 392 | checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" 393 | dependencies = [ 394 | "dirs-sys", 395 | ] 396 | 397 | [[package]] 398 | name = "dirs-sys" 399 | version = "0.3.7" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" 402 | dependencies = [ 403 | "libc", 404 | "redox_users", 405 | "winapi", 406 | ] 407 | 408 | [[package]] 409 | name = "dotenvy" 410 | version = "0.15.6" 411 | source = "registry+https://github.com/rust-lang/crates.io-index" 412 | checksum = "03d8c417d7a8cb362e0c37e5d815f5eb7c37f79ff93707329d5a194e42e54ca0" 413 | 414 | [[package]] 415 | name = "either" 416 | version = "1.8.0" 417 | source = "registry+https://github.com/rust-lang/crates.io-index" 418 | checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" 419 | 420 | [[package]] 421 | name = "error-stack" 422 | version = "0.2.4" 423 | source = "registry+https://github.com/rust-lang/crates.io-index" 424 | checksum = "859d224e04b2d93d974c08e375dac9b8d1a513846e44c6666450a57b1ed963f9" 425 | dependencies = [ 426 | "anyhow", 427 | "owo-colors", 428 | "rustc_version", 429 | ] 430 | 431 | [[package]] 432 | name = "event-listener" 433 | version = "2.5.3" 434 | source = "registry+https://github.com/rust-lang/crates.io-index" 435 | checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" 436 | 437 | [[package]] 438 | name = "fastrand" 439 | version = "1.8.0" 440 | source = "registry+https://github.com/rust-lang/crates.io-index" 441 | checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" 442 | dependencies = [ 443 | "instant", 444 | ] 445 | 446 | [[package]] 447 | name = "fnv" 448 | version = "1.0.7" 449 | source = "registry+https://github.com/rust-lang/crates.io-index" 450 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 451 | 452 | [[package]] 453 | name = "foreign-types" 454 | version = "0.3.2" 455 | source = "registry+https://github.com/rust-lang/crates.io-index" 456 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 457 | dependencies = [ 458 | "foreign-types-shared", 459 | ] 460 | 461 | [[package]] 462 | name = "foreign-types-shared" 463 | version = "0.1.1" 464 | source = "registry+https://github.com/rust-lang/crates.io-index" 465 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 466 | 467 | [[package]] 468 | name = "form_urlencoded" 469 | version = "1.1.0" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" 472 | dependencies = [ 473 | "percent-encoding", 474 | ] 475 | 476 | [[package]] 477 | name = "futures-channel" 478 | version = "0.3.25" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" 481 | dependencies = [ 482 | "futures-core", 483 | "futures-sink", 484 | ] 485 | 486 | [[package]] 487 | name = "futures-core" 488 | version = "0.3.25" 489 | source = "registry+https://github.com/rust-lang/crates.io-index" 490 | checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" 491 | 492 | [[package]] 493 | name = "futures-intrusive" 494 | version = "0.4.2" 495 | source = "registry+https://github.com/rust-lang/crates.io-index" 496 | checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" 497 | dependencies = [ 498 | "futures-core", 499 | "lock_api", 500 | "parking_lot", 501 | ] 502 | 503 | [[package]] 504 | name = "futures-sink" 505 | version = "0.3.25" 506 | source = "registry+https://github.com/rust-lang/crates.io-index" 507 | checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" 508 | 509 | [[package]] 510 | name = "futures-task" 511 | version = "0.3.25" 512 | source = "registry+https://github.com/rust-lang/crates.io-index" 513 | checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" 514 | 515 | [[package]] 516 | name = "futures-util" 517 | version = "0.3.25" 518 | source = "registry+https://github.com/rust-lang/crates.io-index" 519 | checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" 520 | dependencies = [ 521 | "futures-core", 522 | "futures-sink", 523 | "futures-task", 524 | "pin-project-lite", 525 | "pin-utils", 526 | ] 527 | 528 | [[package]] 529 | name = "generic-array" 530 | version = "0.14.6" 531 | source = "registry+https://github.com/rust-lang/crates.io-index" 532 | checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" 533 | dependencies = [ 534 | "typenum", 535 | "version_check", 536 | ] 537 | 538 | [[package]] 539 | name = "getrandom" 540 | version = "0.2.8" 541 | source = "registry+https://github.com/rust-lang/crates.io-index" 542 | checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" 543 | dependencies = [ 544 | "cfg-if", 545 | "libc", 546 | "wasi", 547 | ] 548 | 549 | [[package]] 550 | name = "h2" 551 | version = "0.3.15" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" 554 | dependencies = [ 555 | "bytes", 556 | "fnv", 557 | "futures-core", 558 | "futures-sink", 559 | "futures-util", 560 | "http", 561 | "indexmap", 562 | "slab", 563 | "tokio", 564 | "tokio-util", 565 | "tracing", 566 | ] 567 | 568 | [[package]] 569 | name = "hashbrown" 570 | version = "0.12.3" 571 | source = "registry+https://github.com/rust-lang/crates.io-index" 572 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 573 | dependencies = [ 574 | "ahash", 575 | ] 576 | 577 | [[package]] 578 | name = "hashlink" 579 | version = "0.8.1" 580 | source = "registry+https://github.com/rust-lang/crates.io-index" 581 | checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" 582 | dependencies = [ 583 | "hashbrown", 584 | ] 585 | 586 | [[package]] 587 | name = "heck" 588 | version = "0.4.0" 589 | source = "registry+https://github.com/rust-lang/crates.io-index" 590 | checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" 591 | dependencies = [ 592 | "unicode-segmentation", 593 | ] 594 | 595 | [[package]] 596 | name = "hermit-abi" 597 | version = "0.1.19" 598 | source = "registry+https://github.com/rust-lang/crates.io-index" 599 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 600 | dependencies = [ 601 | "libc", 602 | ] 603 | 604 | [[package]] 605 | name = "hex" 606 | version = "0.4.3" 607 | source = "registry+https://github.com/rust-lang/crates.io-index" 608 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 609 | 610 | [[package]] 611 | name = "hkdf" 612 | version = "0.12.3" 613 | source = "registry+https://github.com/rust-lang/crates.io-index" 614 | checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" 615 | dependencies = [ 616 | "hmac", 617 | ] 618 | 619 | [[package]] 620 | name = "hmac" 621 | version = "0.12.1" 622 | source = "registry+https://github.com/rust-lang/crates.io-index" 623 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" 624 | dependencies = [ 625 | "digest", 626 | ] 627 | 628 | [[package]] 629 | name = "http" 630 | version = "0.2.8" 631 | source = "registry+https://github.com/rust-lang/crates.io-index" 632 | checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" 633 | dependencies = [ 634 | "bytes", 635 | "fnv", 636 | "itoa", 637 | ] 638 | 639 | [[package]] 640 | name = "http-body" 641 | version = "0.4.5" 642 | source = "registry+https://github.com/rust-lang/crates.io-index" 643 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" 644 | dependencies = [ 645 | "bytes", 646 | "http", 647 | "pin-project-lite", 648 | ] 649 | 650 | [[package]] 651 | name = "http-range-header" 652 | version = "0.3.0" 653 | source = "registry+https://github.com/rust-lang/crates.io-index" 654 | checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" 655 | 656 | [[package]] 657 | name = "httparse" 658 | version = "1.8.0" 659 | source = "registry+https://github.com/rust-lang/crates.io-index" 660 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 661 | 662 | [[package]] 663 | name = "httpdate" 664 | version = "1.0.2" 665 | source = "registry+https://github.com/rust-lang/crates.io-index" 666 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 667 | 668 | [[package]] 669 | name = "hyper" 670 | version = "0.14.23" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" 673 | dependencies = [ 674 | "bytes", 675 | "futures-channel", 676 | "futures-core", 677 | "futures-util", 678 | "h2", 679 | "http", 680 | "http-body", 681 | "httparse", 682 | "httpdate", 683 | "itoa", 684 | "pin-project-lite", 685 | "socket2", 686 | "tokio", 687 | "tower-service", 688 | "tracing", 689 | "want", 690 | ] 691 | 692 | [[package]] 693 | name = "iana-time-zone" 694 | version = "0.1.53" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" 697 | dependencies = [ 698 | "android_system_properties", 699 | "core-foundation-sys", 700 | "iana-time-zone-haiku", 701 | "js-sys", 702 | "wasm-bindgen", 703 | "winapi", 704 | ] 705 | 706 | [[package]] 707 | name = "iana-time-zone-haiku" 708 | version = "0.1.1" 709 | source = "registry+https://github.com/rust-lang/crates.io-index" 710 | checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" 711 | dependencies = [ 712 | "cxx", 713 | "cxx-build", 714 | ] 715 | 716 | [[package]] 717 | name = "ident_case" 718 | version = "1.0.1" 719 | source = "registry+https://github.com/rust-lang/crates.io-index" 720 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 721 | 722 | [[package]] 723 | name = "idna" 724 | version = "0.3.0" 725 | source = "registry+https://github.com/rust-lang/crates.io-index" 726 | checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" 727 | dependencies = [ 728 | "unicode-bidi", 729 | "unicode-normalization", 730 | ] 731 | 732 | [[package]] 733 | name = "indexmap" 734 | version = "1.9.1" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" 737 | dependencies = [ 738 | "autocfg", 739 | "hashbrown", 740 | "serde", 741 | ] 742 | 743 | [[package]] 744 | name = "instant" 745 | version = "0.1.12" 746 | source = "registry+https://github.com/rust-lang/crates.io-index" 747 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 748 | dependencies = [ 749 | "cfg-if", 750 | ] 751 | 752 | [[package]] 753 | name = "is_ci" 754 | version = "1.1.1" 755 | source = "registry+https://github.com/rust-lang/crates.io-index" 756 | checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" 757 | 758 | [[package]] 759 | name = "itertools" 760 | version = "0.10.5" 761 | source = "registry+https://github.com/rust-lang/crates.io-index" 762 | checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" 763 | dependencies = [ 764 | "either", 765 | ] 766 | 767 | [[package]] 768 | name = "itoa" 769 | version = "1.0.4" 770 | source = "registry+https://github.com/rust-lang/crates.io-index" 771 | checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" 772 | 773 | [[package]] 774 | name = "js-sys" 775 | version = "0.3.60" 776 | source = "registry+https://github.com/rust-lang/crates.io-index" 777 | checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" 778 | dependencies = [ 779 | "wasm-bindgen", 780 | ] 781 | 782 | [[package]] 783 | name = "lazy_static" 784 | version = "1.4.0" 785 | source = "registry+https://github.com/rust-lang/crates.io-index" 786 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 787 | 788 | [[package]] 789 | name = "libc" 790 | version = "0.2.137" 791 | source = "registry+https://github.com/rust-lang/crates.io-index" 792 | checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" 793 | 794 | [[package]] 795 | name = "link-cplusplus" 796 | version = "1.0.7" 797 | source = "registry+https://github.com/rust-lang/crates.io-index" 798 | checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" 799 | dependencies = [ 800 | "cc", 801 | ] 802 | 803 | [[package]] 804 | name = "lock_api" 805 | version = "0.4.9" 806 | source = "registry+https://github.com/rust-lang/crates.io-index" 807 | checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" 808 | dependencies = [ 809 | "autocfg", 810 | "scopeguard", 811 | ] 812 | 813 | [[package]] 814 | name = "log" 815 | version = "0.4.17" 816 | source = "registry+https://github.com/rust-lang/crates.io-index" 817 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 818 | dependencies = [ 819 | "cfg-if", 820 | ] 821 | 822 | [[package]] 823 | name = "matchers" 824 | version = "0.1.0" 825 | source = "registry+https://github.com/rust-lang/crates.io-index" 826 | checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" 827 | dependencies = [ 828 | "regex-automata", 829 | ] 830 | 831 | [[package]] 832 | name = "matchit" 833 | version = "0.7.0" 834 | source = "registry+https://github.com/rust-lang/crates.io-index" 835 | checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" 836 | 837 | [[package]] 838 | name = "md-5" 839 | version = "0.10.5" 840 | source = "registry+https://github.com/rust-lang/crates.io-index" 841 | checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" 842 | dependencies = [ 843 | "digest", 844 | ] 845 | 846 | [[package]] 847 | name = "memchr" 848 | version = "2.5.0" 849 | source = "registry+https://github.com/rust-lang/crates.io-index" 850 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 851 | 852 | [[package]] 853 | name = "mime" 854 | version = "0.3.16" 855 | source = "registry+https://github.com/rust-lang/crates.io-index" 856 | checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 857 | 858 | [[package]] 859 | name = "minimal-lexical" 860 | version = "0.2.1" 861 | source = "registry+https://github.com/rust-lang/crates.io-index" 862 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 863 | 864 | [[package]] 865 | name = "mio" 866 | version = "0.8.5" 867 | source = "registry+https://github.com/rust-lang/crates.io-index" 868 | checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" 869 | dependencies = [ 870 | "libc", 871 | "log", 872 | "wasi", 873 | "windows-sys 0.42.0", 874 | ] 875 | 876 | [[package]] 877 | name = "native-tls" 878 | version = "0.2.11" 879 | source = "registry+https://github.com/rust-lang/crates.io-index" 880 | checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" 881 | dependencies = [ 882 | "lazy_static", 883 | "libc", 884 | "log", 885 | "openssl", 886 | "openssl-probe", 887 | "openssl-sys", 888 | "schannel", 889 | "security-framework", 890 | "security-framework-sys", 891 | "tempfile", 892 | ] 893 | 894 | [[package]] 895 | name = "nom" 896 | version = "7.1.1" 897 | source = "registry+https://github.com/rust-lang/crates.io-index" 898 | checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" 899 | dependencies = [ 900 | "memchr", 901 | "minimal-lexical", 902 | ] 903 | 904 | [[package]] 905 | name = "nu-ansi-term" 906 | version = "0.46.0" 907 | source = "registry+https://github.com/rust-lang/crates.io-index" 908 | checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" 909 | dependencies = [ 910 | "overload", 911 | "winapi", 912 | ] 913 | 914 | [[package]] 915 | name = "num-integer" 916 | version = "0.1.45" 917 | source = "registry+https://github.com/rust-lang/crates.io-index" 918 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 919 | dependencies = [ 920 | "autocfg", 921 | "num-traits", 922 | ] 923 | 924 | [[package]] 925 | name = "num-traits" 926 | version = "0.2.15" 927 | source = "registry+https://github.com/rust-lang/crates.io-index" 928 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 929 | dependencies = [ 930 | "autocfg", 931 | ] 932 | 933 | [[package]] 934 | name = "num_cpus" 935 | version = "1.14.0" 936 | source = "registry+https://github.com/rust-lang/crates.io-index" 937 | checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" 938 | dependencies = [ 939 | "hermit-abi", 940 | "libc", 941 | ] 942 | 943 | [[package]] 944 | name = "once_cell" 945 | version = "1.16.0" 946 | source = "registry+https://github.com/rust-lang/crates.io-index" 947 | checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" 948 | 949 | [[package]] 950 | name = "openssl" 951 | version = "0.10.42" 952 | source = "registry+https://github.com/rust-lang/crates.io-index" 953 | checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" 954 | dependencies = [ 955 | "bitflags", 956 | "cfg-if", 957 | "foreign-types", 958 | "libc", 959 | "once_cell", 960 | "openssl-macros", 961 | "openssl-sys", 962 | ] 963 | 964 | [[package]] 965 | name = "openssl-macros" 966 | version = "0.1.0" 967 | source = "registry+https://github.com/rust-lang/crates.io-index" 968 | checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" 969 | dependencies = [ 970 | "proc-macro2", 971 | "quote", 972 | "syn", 973 | ] 974 | 975 | [[package]] 976 | name = "openssl-probe" 977 | version = "0.1.5" 978 | source = "registry+https://github.com/rust-lang/crates.io-index" 979 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 980 | 981 | [[package]] 982 | name = "openssl-sys" 983 | version = "0.9.77" 984 | source = "registry+https://github.com/rust-lang/crates.io-index" 985 | checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" 986 | dependencies = [ 987 | "autocfg", 988 | "cc", 989 | "libc", 990 | "pkg-config", 991 | "vcpkg", 992 | ] 993 | 994 | [[package]] 995 | name = "os_str_bytes" 996 | version = "6.4.0" 997 | source = "registry+https://github.com/rust-lang/crates.io-index" 998 | checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" 999 | 1000 | [[package]] 1001 | name = "overload" 1002 | version = "0.1.1" 1003 | source = "registry+https://github.com/rust-lang/crates.io-index" 1004 | checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 1005 | 1006 | [[package]] 1007 | name = "owo-colors" 1008 | version = "3.5.0" 1009 | source = "registry+https://github.com/rust-lang/crates.io-index" 1010 | checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" 1011 | dependencies = [ 1012 | "supports-color", 1013 | ] 1014 | 1015 | [[package]] 1016 | name = "parking_lot" 1017 | version = "0.11.2" 1018 | source = "registry+https://github.com/rust-lang/crates.io-index" 1019 | checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" 1020 | dependencies = [ 1021 | "instant", 1022 | "lock_api", 1023 | "parking_lot_core", 1024 | ] 1025 | 1026 | [[package]] 1027 | name = "parking_lot_core" 1028 | version = "0.8.5" 1029 | source = "registry+https://github.com/rust-lang/crates.io-index" 1030 | checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" 1031 | dependencies = [ 1032 | "cfg-if", 1033 | "instant", 1034 | "libc", 1035 | "redox_syscall", 1036 | "smallvec", 1037 | "winapi", 1038 | ] 1039 | 1040 | [[package]] 1041 | name = "paste" 1042 | version = "1.0.9" 1043 | source = "registry+https://github.com/rust-lang/crates.io-index" 1044 | checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" 1045 | 1046 | [[package]] 1047 | name = "percent-encoding" 1048 | version = "2.2.0" 1049 | source = "registry+https://github.com/rust-lang/crates.io-index" 1050 | checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" 1051 | 1052 | [[package]] 1053 | name = "pin-project" 1054 | version = "1.0.12" 1055 | source = "registry+https://github.com/rust-lang/crates.io-index" 1056 | checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" 1057 | dependencies = [ 1058 | "pin-project-internal", 1059 | ] 1060 | 1061 | [[package]] 1062 | name = "pin-project-internal" 1063 | version = "1.0.12" 1064 | source = "registry+https://github.com/rust-lang/crates.io-index" 1065 | checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" 1066 | dependencies = [ 1067 | "proc-macro2", 1068 | "quote", 1069 | "syn", 1070 | ] 1071 | 1072 | [[package]] 1073 | name = "pin-project-lite" 1074 | version = "0.2.9" 1075 | source = "registry+https://github.com/rust-lang/crates.io-index" 1076 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 1077 | 1078 | [[package]] 1079 | name = "pin-utils" 1080 | version = "0.1.0" 1081 | source = "registry+https://github.com/rust-lang/crates.io-index" 1082 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1083 | 1084 | [[package]] 1085 | name = "pkg-config" 1086 | version = "0.3.26" 1087 | source = "registry+https://github.com/rust-lang/crates.io-index" 1088 | checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" 1089 | 1090 | [[package]] 1091 | name = "ppv-lite86" 1092 | version = "0.2.17" 1093 | source = "registry+https://github.com/rust-lang/crates.io-index" 1094 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 1095 | 1096 | [[package]] 1097 | name = "proc-macro-error" 1098 | version = "1.0.4" 1099 | source = "registry+https://github.com/rust-lang/crates.io-index" 1100 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 1101 | dependencies = [ 1102 | "proc-macro-error-attr", 1103 | "proc-macro2", 1104 | "quote", 1105 | "syn", 1106 | "version_check", 1107 | ] 1108 | 1109 | [[package]] 1110 | name = "proc-macro-error-attr" 1111 | version = "1.0.4" 1112 | source = "registry+https://github.com/rust-lang/crates.io-index" 1113 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 1114 | dependencies = [ 1115 | "proc-macro2", 1116 | "quote", 1117 | "version_check", 1118 | ] 1119 | 1120 | [[package]] 1121 | name = "proc-macro2" 1122 | version = "1.0.47" 1123 | source = "registry+https://github.com/rust-lang/crates.io-index" 1124 | checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" 1125 | dependencies = [ 1126 | "unicode-ident", 1127 | ] 1128 | 1129 | [[package]] 1130 | name = "quote" 1131 | version = "1.0.21" 1132 | source = "registry+https://github.com/rust-lang/crates.io-index" 1133 | checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" 1134 | dependencies = [ 1135 | "proc-macro2", 1136 | ] 1137 | 1138 | [[package]] 1139 | name = "rand" 1140 | version = "0.8.5" 1141 | source = "registry+https://github.com/rust-lang/crates.io-index" 1142 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1143 | dependencies = [ 1144 | "libc", 1145 | "rand_chacha", 1146 | "rand_core", 1147 | ] 1148 | 1149 | [[package]] 1150 | name = "rand_chacha" 1151 | version = "0.3.1" 1152 | source = "registry+https://github.com/rust-lang/crates.io-index" 1153 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1154 | dependencies = [ 1155 | "ppv-lite86", 1156 | "rand_core", 1157 | ] 1158 | 1159 | [[package]] 1160 | name = "rand_core" 1161 | version = "0.6.4" 1162 | source = "registry+https://github.com/rust-lang/crates.io-index" 1163 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1164 | dependencies = [ 1165 | "getrandom", 1166 | ] 1167 | 1168 | [[package]] 1169 | name = "redox_syscall" 1170 | version = "0.2.16" 1171 | source = "registry+https://github.com/rust-lang/crates.io-index" 1172 | checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" 1173 | dependencies = [ 1174 | "bitflags", 1175 | ] 1176 | 1177 | [[package]] 1178 | name = "redox_users" 1179 | version = "0.4.3" 1180 | source = "registry+https://github.com/rust-lang/crates.io-index" 1181 | checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" 1182 | dependencies = [ 1183 | "getrandom", 1184 | "redox_syscall", 1185 | "thiserror", 1186 | ] 1187 | 1188 | [[package]] 1189 | name = "regex" 1190 | version = "1.7.0" 1191 | source = "registry+https://github.com/rust-lang/crates.io-index" 1192 | checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" 1193 | dependencies = [ 1194 | "regex-syntax", 1195 | ] 1196 | 1197 | [[package]] 1198 | name = "regex-automata" 1199 | version = "0.1.10" 1200 | source = "registry+https://github.com/rust-lang/crates.io-index" 1201 | checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" 1202 | dependencies = [ 1203 | "regex-syntax", 1204 | ] 1205 | 1206 | [[package]] 1207 | name = "regex-syntax" 1208 | version = "0.6.28" 1209 | source = "registry+https://github.com/rust-lang/crates.io-index" 1210 | checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" 1211 | 1212 | [[package]] 1213 | name = "remove_dir_all" 1214 | version = "0.5.3" 1215 | source = "registry+https://github.com/rust-lang/crates.io-index" 1216 | checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 1217 | dependencies = [ 1218 | "winapi", 1219 | ] 1220 | 1221 | [[package]] 1222 | name = "rustc_version" 1223 | version = "0.4.0" 1224 | source = "registry+https://github.com/rust-lang/crates.io-index" 1225 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 1226 | dependencies = [ 1227 | "semver", 1228 | ] 1229 | 1230 | [[package]] 1231 | name = "rustversion" 1232 | version = "1.0.9" 1233 | source = "registry+https://github.com/rust-lang/crates.io-index" 1234 | checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" 1235 | 1236 | [[package]] 1237 | name = "ryu" 1238 | version = "1.0.11" 1239 | source = "registry+https://github.com/rust-lang/crates.io-index" 1240 | checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" 1241 | 1242 | [[package]] 1243 | name = "sample-config" 1244 | version = "0.1.0" 1245 | source = "git+https://github.com/FlixCoder/sample-config?rev=8d00c5772f04e1340034bb0d44c81f392633bb71#8d00c5772f04e1340034bb0d44c81f392633bb71" 1246 | dependencies = [ 1247 | "sample-config-macros", 1248 | "tracing", 1249 | ] 1250 | 1251 | [[package]] 1252 | name = "sample-config-macros" 1253 | version = "0.1.0" 1254 | source = "git+https://github.com/FlixCoder/sample-config?rev=8d00c5772f04e1340034bb0d44c81f392633bb71#8d00c5772f04e1340034bb0d44c81f392633bb71" 1255 | dependencies = [ 1256 | "proc-macro2", 1257 | "quote", 1258 | "syn", 1259 | ] 1260 | 1261 | [[package]] 1262 | name = "schannel" 1263 | version = "0.1.20" 1264 | source = "registry+https://github.com/rust-lang/crates.io-index" 1265 | checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" 1266 | dependencies = [ 1267 | "lazy_static", 1268 | "windows-sys 0.36.1", 1269 | ] 1270 | 1271 | [[package]] 1272 | name = "scopeguard" 1273 | version = "1.1.0" 1274 | source = "registry+https://github.com/rust-lang/crates.io-index" 1275 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 1276 | 1277 | [[package]] 1278 | name = "scratch" 1279 | version = "1.0.2" 1280 | source = "registry+https://github.com/rust-lang/crates.io-index" 1281 | checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" 1282 | 1283 | [[package]] 1284 | name = "security-framework" 1285 | version = "2.7.0" 1286 | source = "registry+https://github.com/rust-lang/crates.io-index" 1287 | checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" 1288 | dependencies = [ 1289 | "bitflags", 1290 | "core-foundation", 1291 | "core-foundation-sys", 1292 | "libc", 1293 | "security-framework-sys", 1294 | ] 1295 | 1296 | [[package]] 1297 | name = "security-framework-sys" 1298 | version = "2.6.1" 1299 | source = "registry+https://github.com/rust-lang/crates.io-index" 1300 | checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" 1301 | dependencies = [ 1302 | "core-foundation-sys", 1303 | "libc", 1304 | ] 1305 | 1306 | [[package]] 1307 | name = "semver" 1308 | version = "1.0.14" 1309 | source = "registry+https://github.com/rust-lang/crates.io-index" 1310 | checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" 1311 | 1312 | [[package]] 1313 | name = "serde" 1314 | version = "1.0.147" 1315 | source = "registry+https://github.com/rust-lang/crates.io-index" 1316 | checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" 1317 | dependencies = [ 1318 | "serde_derive", 1319 | ] 1320 | 1321 | [[package]] 1322 | name = "serde_derive" 1323 | version = "1.0.147" 1324 | source = "registry+https://github.com/rust-lang/crates.io-index" 1325 | checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" 1326 | dependencies = [ 1327 | "proc-macro2", 1328 | "quote", 1329 | "syn", 1330 | ] 1331 | 1332 | [[package]] 1333 | name = "serde_json" 1334 | version = "1.0.87" 1335 | source = "registry+https://github.com/rust-lang/crates.io-index" 1336 | checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" 1337 | dependencies = [ 1338 | "itoa", 1339 | "ryu", 1340 | "serde", 1341 | ] 1342 | 1343 | [[package]] 1344 | name = "serde_path_to_error" 1345 | version = "0.1.8" 1346 | source = "registry+https://github.com/rust-lang/crates.io-index" 1347 | checksum = "184c643044780f7ceb59104cef98a5a6f12cb2288a7bc701ab93a362b49fd47d" 1348 | dependencies = [ 1349 | "serde", 1350 | ] 1351 | 1352 | [[package]] 1353 | name = "serde_urlencoded" 1354 | version = "0.7.1" 1355 | source = "registry+https://github.com/rust-lang/crates.io-index" 1356 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 1357 | dependencies = [ 1358 | "form_urlencoded", 1359 | "itoa", 1360 | "ryu", 1361 | "serde", 1362 | ] 1363 | 1364 | [[package]] 1365 | name = "serde_with" 1366 | version = "2.0.1" 1367 | source = "registry+https://github.com/rust-lang/crates.io-index" 1368 | checksum = "368f2d60d049ea019a84dcd6687b0d1e0030fe663ae105039bdf967ed5e6a9a7" 1369 | dependencies = [ 1370 | "base64", 1371 | "chrono", 1372 | "hex", 1373 | "indexmap", 1374 | "serde", 1375 | "serde_json", 1376 | "serde_with_macros", 1377 | "time", 1378 | ] 1379 | 1380 | [[package]] 1381 | name = "serde_with_macros" 1382 | version = "2.0.1" 1383 | source = "registry+https://github.com/rust-lang/crates.io-index" 1384 | checksum = "1ccadfacf6cf10faad22bbadf55986bdd0856edfb5d9210aa1dcf1f516e84e93" 1385 | dependencies = [ 1386 | "darling", 1387 | "proc-macro2", 1388 | "quote", 1389 | "syn", 1390 | ] 1391 | 1392 | [[package]] 1393 | name = "serde_yaml" 1394 | version = "0.9.14" 1395 | source = "registry+https://github.com/rust-lang/crates.io-index" 1396 | checksum = "6d232d893b10de3eb7258ff01974d6ee20663d8e833263c99409d4b13a0209da" 1397 | dependencies = [ 1398 | "indexmap", 1399 | "itoa", 1400 | "ryu", 1401 | "serde", 1402 | "unsafe-libyaml", 1403 | ] 1404 | 1405 | [[package]] 1406 | name = "sha1" 1407 | version = "0.10.5" 1408 | source = "registry+https://github.com/rust-lang/crates.io-index" 1409 | checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" 1410 | dependencies = [ 1411 | "cfg-if", 1412 | "cpufeatures", 1413 | "digest", 1414 | ] 1415 | 1416 | [[package]] 1417 | name = "sha2" 1418 | version = "0.10.6" 1419 | source = "registry+https://github.com/rust-lang/crates.io-index" 1420 | checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" 1421 | dependencies = [ 1422 | "cfg-if", 1423 | "cpufeatures", 1424 | "digest", 1425 | ] 1426 | 1427 | [[package]] 1428 | name = "sharded-slab" 1429 | version = "0.1.4" 1430 | source = "registry+https://github.com/rust-lang/crates.io-index" 1431 | checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" 1432 | dependencies = [ 1433 | "lazy_static", 1434 | ] 1435 | 1436 | [[package]] 1437 | name = "slab" 1438 | version = "0.4.7" 1439 | source = "registry+https://github.com/rust-lang/crates.io-index" 1440 | checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" 1441 | dependencies = [ 1442 | "autocfg", 1443 | ] 1444 | 1445 | [[package]] 1446 | name = "smallvec" 1447 | version = "1.10.0" 1448 | source = "registry+https://github.com/rust-lang/crates.io-index" 1449 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 1450 | 1451 | [[package]] 1452 | name = "socket2" 1453 | version = "0.4.7" 1454 | source = "registry+https://github.com/rust-lang/crates.io-index" 1455 | checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" 1456 | dependencies = [ 1457 | "libc", 1458 | "winapi", 1459 | ] 1460 | 1461 | [[package]] 1462 | name = "sqlformat" 1463 | version = "0.2.0" 1464 | source = "registry+https://github.com/rust-lang/crates.io-index" 1465 | checksum = "f87e292b4291f154971a43c3774364e2cbcaec599d3f5bf6fa9d122885dbc38a" 1466 | dependencies = [ 1467 | "itertools", 1468 | "nom", 1469 | "unicode_categories", 1470 | ] 1471 | 1472 | [[package]] 1473 | name = "sqlx" 1474 | version = "0.6.2" 1475 | source = "registry+https://github.com/rust-lang/crates.io-index" 1476 | checksum = "9249290c05928352f71c077cc44a464d880c63f26f7534728cca008e135c0428" 1477 | dependencies = [ 1478 | "sqlx-core", 1479 | "sqlx-macros", 1480 | ] 1481 | 1482 | [[package]] 1483 | name = "sqlx-core" 1484 | version = "0.6.2" 1485 | source = "registry+https://github.com/rust-lang/crates.io-index" 1486 | checksum = "dcbc16ddba161afc99e14d1713a453747a2b07fc097d2009f4c300ec99286105" 1487 | dependencies = [ 1488 | "ahash", 1489 | "atoi", 1490 | "base64", 1491 | "bitflags", 1492 | "byteorder", 1493 | "bytes", 1494 | "crc", 1495 | "crossbeam-queue", 1496 | "dirs", 1497 | "dotenvy", 1498 | "either", 1499 | "event-listener", 1500 | "futures-channel", 1501 | "futures-core", 1502 | "futures-intrusive", 1503 | "futures-util", 1504 | "hashlink", 1505 | "hex", 1506 | "hkdf", 1507 | "hmac", 1508 | "indexmap", 1509 | "itoa", 1510 | "libc", 1511 | "log", 1512 | "md-5", 1513 | "memchr", 1514 | "once_cell", 1515 | "paste", 1516 | "percent-encoding", 1517 | "rand", 1518 | "serde", 1519 | "serde_json", 1520 | "sha1", 1521 | "sha2", 1522 | "smallvec", 1523 | "sqlformat", 1524 | "sqlx-rt", 1525 | "stringprep", 1526 | "thiserror", 1527 | "tokio-stream", 1528 | "url", 1529 | "whoami", 1530 | ] 1531 | 1532 | [[package]] 1533 | name = "sqlx-macros" 1534 | version = "0.6.2" 1535 | source = "registry+https://github.com/rust-lang/crates.io-index" 1536 | checksum = "b850fa514dc11f2ee85be9d055c512aa866746adfacd1cb42d867d68e6a5b0d9" 1537 | dependencies = [ 1538 | "dotenvy", 1539 | "either", 1540 | "heck", 1541 | "once_cell", 1542 | "proc-macro2", 1543 | "quote", 1544 | "sha2", 1545 | "sqlx-core", 1546 | "sqlx-rt", 1547 | "syn", 1548 | "url", 1549 | ] 1550 | 1551 | [[package]] 1552 | name = "sqlx-rt" 1553 | version = "0.6.2" 1554 | source = "registry+https://github.com/rust-lang/crates.io-index" 1555 | checksum = "24c5b2d25fa654cc5f841750b8e1cdedbe21189bf9a9382ee90bfa9dd3562396" 1556 | dependencies = [ 1557 | "native-tls", 1558 | "once_cell", 1559 | "tokio", 1560 | "tokio-native-tls", 1561 | ] 1562 | 1563 | [[package]] 1564 | name = "stringprep" 1565 | version = "0.1.2" 1566 | source = "registry+https://github.com/rust-lang/crates.io-index" 1567 | checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" 1568 | dependencies = [ 1569 | "unicode-bidi", 1570 | "unicode-normalization", 1571 | ] 1572 | 1573 | [[package]] 1574 | name = "strsim" 1575 | version = "0.10.0" 1576 | source = "registry+https://github.com/rust-lang/crates.io-index" 1577 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 1578 | 1579 | [[package]] 1580 | name = "subtle" 1581 | version = "2.4.1" 1582 | source = "registry+https://github.com/rust-lang/crates.io-index" 1583 | checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" 1584 | 1585 | [[package]] 1586 | name = "supports-color" 1587 | version = "1.3.1" 1588 | source = "registry+https://github.com/rust-lang/crates.io-index" 1589 | checksum = "8ba6faf2ca7ee42fdd458f4347ae0a9bd6bcc445ad7cb57ad82b383f18870d6f" 1590 | dependencies = [ 1591 | "atty", 1592 | "is_ci", 1593 | ] 1594 | 1595 | [[package]] 1596 | name = "syn" 1597 | version = "1.0.103" 1598 | source = "registry+https://github.com/rust-lang/crates.io-index" 1599 | checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" 1600 | dependencies = [ 1601 | "proc-macro2", 1602 | "quote", 1603 | "unicode-ident", 1604 | ] 1605 | 1606 | [[package]] 1607 | name = "sync_wrapper" 1608 | version = "0.1.1" 1609 | source = "registry+https://github.com/rust-lang/crates.io-index" 1610 | checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" 1611 | 1612 | [[package]] 1613 | name = "tempfile" 1614 | version = "3.3.0" 1615 | source = "registry+https://github.com/rust-lang/crates.io-index" 1616 | checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" 1617 | dependencies = [ 1618 | "cfg-if", 1619 | "fastrand", 1620 | "libc", 1621 | "redox_syscall", 1622 | "remove_dir_all", 1623 | "winapi", 1624 | ] 1625 | 1626 | [[package]] 1627 | name = "template-web-service" 1628 | version = "0.1.0" 1629 | dependencies = [ 1630 | "axum", 1631 | "clap", 1632 | "error-stack", 1633 | "hyper", 1634 | "sample-config", 1635 | "serde", 1636 | "serde_with", 1637 | "serde_yaml", 1638 | "sqlx", 1639 | "thiserror", 1640 | "timed-locks", 1641 | "tokio", 1642 | "tracing", 1643 | "tracing-futures", 1644 | "tracing-subscriber", 1645 | ] 1646 | 1647 | [[package]] 1648 | name = "termcolor" 1649 | version = "1.1.3" 1650 | source = "registry+https://github.com/rust-lang/crates.io-index" 1651 | checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" 1652 | dependencies = [ 1653 | "winapi-util", 1654 | ] 1655 | 1656 | [[package]] 1657 | name = "thiserror" 1658 | version = "1.0.37" 1659 | source = "registry+https://github.com/rust-lang/crates.io-index" 1660 | checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" 1661 | dependencies = [ 1662 | "thiserror-impl", 1663 | ] 1664 | 1665 | [[package]] 1666 | name = "thiserror-impl" 1667 | version = "1.0.37" 1668 | source = "registry+https://github.com/rust-lang/crates.io-index" 1669 | checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" 1670 | dependencies = [ 1671 | "proc-macro2", 1672 | "quote", 1673 | "syn", 1674 | ] 1675 | 1676 | [[package]] 1677 | name = "thread_local" 1678 | version = "1.1.4" 1679 | source = "registry+https://github.com/rust-lang/crates.io-index" 1680 | checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" 1681 | dependencies = [ 1682 | "once_cell", 1683 | ] 1684 | 1685 | [[package]] 1686 | name = "time" 1687 | version = "0.3.17" 1688 | source = "registry+https://github.com/rust-lang/crates.io-index" 1689 | checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" 1690 | dependencies = [ 1691 | "itoa", 1692 | "serde", 1693 | "time-core", 1694 | "time-macros", 1695 | ] 1696 | 1697 | [[package]] 1698 | name = "time-core" 1699 | version = "0.1.0" 1700 | source = "registry+https://github.com/rust-lang/crates.io-index" 1701 | checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" 1702 | 1703 | [[package]] 1704 | name = "time-macros" 1705 | version = "0.2.6" 1706 | source = "registry+https://github.com/rust-lang/crates.io-index" 1707 | checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" 1708 | dependencies = [ 1709 | "time-core", 1710 | ] 1711 | 1712 | [[package]] 1713 | name = "timed-locks" 1714 | version = "0.1.1" 1715 | source = "registry+https://github.com/rust-lang/crates.io-index" 1716 | checksum = "e70ab652a1e0c2ccc438672650ff7498c5b60525e209df78b862e4dae72bbe2b" 1717 | dependencies = [ 1718 | "thiserror", 1719 | "tokio", 1720 | ] 1721 | 1722 | [[package]] 1723 | name = "tinyvec" 1724 | version = "1.6.0" 1725 | source = "registry+https://github.com/rust-lang/crates.io-index" 1726 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1727 | dependencies = [ 1728 | "tinyvec_macros", 1729 | ] 1730 | 1731 | [[package]] 1732 | name = "tinyvec_macros" 1733 | version = "0.1.0" 1734 | source = "registry+https://github.com/rust-lang/crates.io-index" 1735 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 1736 | 1737 | [[package]] 1738 | name = "tokio" 1739 | version = "1.21.2" 1740 | source = "registry+https://github.com/rust-lang/crates.io-index" 1741 | checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" 1742 | dependencies = [ 1743 | "autocfg", 1744 | "bytes", 1745 | "libc", 1746 | "memchr", 1747 | "mio", 1748 | "num_cpus", 1749 | "pin-project-lite", 1750 | "socket2", 1751 | "tokio-macros", 1752 | "winapi", 1753 | ] 1754 | 1755 | [[package]] 1756 | name = "tokio-macros" 1757 | version = "1.8.0" 1758 | source = "registry+https://github.com/rust-lang/crates.io-index" 1759 | checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" 1760 | dependencies = [ 1761 | "proc-macro2", 1762 | "quote", 1763 | "syn", 1764 | ] 1765 | 1766 | [[package]] 1767 | name = "tokio-native-tls" 1768 | version = "0.3.0" 1769 | source = "registry+https://github.com/rust-lang/crates.io-index" 1770 | checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" 1771 | dependencies = [ 1772 | "native-tls", 1773 | "tokio", 1774 | ] 1775 | 1776 | [[package]] 1777 | name = "tokio-stream" 1778 | version = "0.1.11" 1779 | source = "registry+https://github.com/rust-lang/crates.io-index" 1780 | checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" 1781 | dependencies = [ 1782 | "futures-core", 1783 | "pin-project-lite", 1784 | "tokio", 1785 | ] 1786 | 1787 | [[package]] 1788 | name = "tokio-util" 1789 | version = "0.7.4" 1790 | source = "registry+https://github.com/rust-lang/crates.io-index" 1791 | checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" 1792 | dependencies = [ 1793 | "bytes", 1794 | "futures-core", 1795 | "futures-sink", 1796 | "pin-project-lite", 1797 | "tokio", 1798 | "tracing", 1799 | ] 1800 | 1801 | [[package]] 1802 | name = "tower" 1803 | version = "0.4.13" 1804 | source = "registry+https://github.com/rust-lang/crates.io-index" 1805 | checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" 1806 | dependencies = [ 1807 | "futures-core", 1808 | "futures-util", 1809 | "pin-project", 1810 | "pin-project-lite", 1811 | "tokio", 1812 | "tower-layer", 1813 | "tower-service", 1814 | "tracing", 1815 | ] 1816 | 1817 | [[package]] 1818 | name = "tower-http" 1819 | version = "0.3.4" 1820 | source = "registry+https://github.com/rust-lang/crates.io-index" 1821 | checksum = "3c530c8675c1dbf98facee631536fa116b5fb6382d7dd6dc1b118d970eafe3ba" 1822 | dependencies = [ 1823 | "bitflags", 1824 | "bytes", 1825 | "futures-core", 1826 | "futures-util", 1827 | "http", 1828 | "http-body", 1829 | "http-range-header", 1830 | "pin-project-lite", 1831 | "tower", 1832 | "tower-layer", 1833 | "tower-service", 1834 | ] 1835 | 1836 | [[package]] 1837 | name = "tower-layer" 1838 | version = "0.3.2" 1839 | source = "registry+https://github.com/rust-lang/crates.io-index" 1840 | checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" 1841 | 1842 | [[package]] 1843 | name = "tower-service" 1844 | version = "0.3.2" 1845 | source = "registry+https://github.com/rust-lang/crates.io-index" 1846 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 1847 | 1848 | [[package]] 1849 | name = "tracing" 1850 | version = "0.1.37" 1851 | source = "registry+https://github.com/rust-lang/crates.io-index" 1852 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" 1853 | dependencies = [ 1854 | "cfg-if", 1855 | "log", 1856 | "pin-project-lite", 1857 | "tracing-attributes", 1858 | "tracing-core", 1859 | ] 1860 | 1861 | [[package]] 1862 | name = "tracing-attributes" 1863 | version = "0.1.23" 1864 | source = "registry+https://github.com/rust-lang/crates.io-index" 1865 | checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" 1866 | dependencies = [ 1867 | "proc-macro2", 1868 | "quote", 1869 | "syn", 1870 | ] 1871 | 1872 | [[package]] 1873 | name = "tracing-core" 1874 | version = "0.1.30" 1875 | source = "registry+https://github.com/rust-lang/crates.io-index" 1876 | checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" 1877 | dependencies = [ 1878 | "once_cell", 1879 | "valuable", 1880 | ] 1881 | 1882 | [[package]] 1883 | name = "tracing-futures" 1884 | version = "0.2.5" 1885 | source = "registry+https://github.com/rust-lang/crates.io-index" 1886 | checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" 1887 | dependencies = [ 1888 | "pin-project", 1889 | "tracing", 1890 | ] 1891 | 1892 | [[package]] 1893 | name = "tracing-log" 1894 | version = "0.1.3" 1895 | source = "registry+https://github.com/rust-lang/crates.io-index" 1896 | checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" 1897 | dependencies = [ 1898 | "lazy_static", 1899 | "log", 1900 | "tracing-core", 1901 | ] 1902 | 1903 | [[package]] 1904 | name = "tracing-subscriber" 1905 | version = "0.3.16" 1906 | source = "registry+https://github.com/rust-lang/crates.io-index" 1907 | checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" 1908 | dependencies = [ 1909 | "matchers", 1910 | "nu-ansi-term", 1911 | "once_cell", 1912 | "regex", 1913 | "sharded-slab", 1914 | "smallvec", 1915 | "thread_local", 1916 | "tracing", 1917 | "tracing-core", 1918 | "tracing-log", 1919 | ] 1920 | 1921 | [[package]] 1922 | name = "try-lock" 1923 | version = "0.2.3" 1924 | source = "registry+https://github.com/rust-lang/crates.io-index" 1925 | checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" 1926 | 1927 | [[package]] 1928 | name = "typenum" 1929 | version = "1.15.0" 1930 | source = "registry+https://github.com/rust-lang/crates.io-index" 1931 | checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" 1932 | 1933 | [[package]] 1934 | name = "unicode-bidi" 1935 | version = "0.3.8" 1936 | source = "registry+https://github.com/rust-lang/crates.io-index" 1937 | checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" 1938 | 1939 | [[package]] 1940 | name = "unicode-ident" 1941 | version = "1.0.5" 1942 | source = "registry+https://github.com/rust-lang/crates.io-index" 1943 | checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" 1944 | 1945 | [[package]] 1946 | name = "unicode-normalization" 1947 | version = "0.1.22" 1948 | source = "registry+https://github.com/rust-lang/crates.io-index" 1949 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 1950 | dependencies = [ 1951 | "tinyvec", 1952 | ] 1953 | 1954 | [[package]] 1955 | name = "unicode-segmentation" 1956 | version = "1.10.0" 1957 | source = "registry+https://github.com/rust-lang/crates.io-index" 1958 | checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" 1959 | 1960 | [[package]] 1961 | name = "unicode-width" 1962 | version = "0.1.10" 1963 | source = "registry+https://github.com/rust-lang/crates.io-index" 1964 | checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" 1965 | 1966 | [[package]] 1967 | name = "unicode_categories" 1968 | version = "0.1.1" 1969 | source = "registry+https://github.com/rust-lang/crates.io-index" 1970 | checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" 1971 | 1972 | [[package]] 1973 | name = "unsafe-libyaml" 1974 | version = "0.2.4" 1975 | source = "registry+https://github.com/rust-lang/crates.io-index" 1976 | checksum = "c1e5fa573d8ac5f1a856f8d7be41d390ee973daf97c806b2c1a465e4e1406e68" 1977 | 1978 | [[package]] 1979 | name = "url" 1980 | version = "2.3.1" 1981 | source = "registry+https://github.com/rust-lang/crates.io-index" 1982 | checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" 1983 | dependencies = [ 1984 | "form_urlencoded", 1985 | "idna", 1986 | "percent-encoding", 1987 | ] 1988 | 1989 | [[package]] 1990 | name = "valuable" 1991 | version = "0.1.0" 1992 | source = "registry+https://github.com/rust-lang/crates.io-index" 1993 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" 1994 | 1995 | [[package]] 1996 | name = "vcpkg" 1997 | version = "0.2.15" 1998 | source = "registry+https://github.com/rust-lang/crates.io-index" 1999 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 2000 | 2001 | [[package]] 2002 | name = "version_check" 2003 | version = "0.9.4" 2004 | source = "registry+https://github.com/rust-lang/crates.io-index" 2005 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 2006 | 2007 | [[package]] 2008 | name = "want" 2009 | version = "0.3.0" 2010 | source = "registry+https://github.com/rust-lang/crates.io-index" 2011 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 2012 | dependencies = [ 2013 | "log", 2014 | "try-lock", 2015 | ] 2016 | 2017 | [[package]] 2018 | name = "wasi" 2019 | version = "0.11.0+wasi-snapshot-preview1" 2020 | source = "registry+https://github.com/rust-lang/crates.io-index" 2021 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 2022 | 2023 | [[package]] 2024 | name = "wasm-bindgen" 2025 | version = "0.2.83" 2026 | source = "registry+https://github.com/rust-lang/crates.io-index" 2027 | checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" 2028 | dependencies = [ 2029 | "cfg-if", 2030 | "wasm-bindgen-macro", 2031 | ] 2032 | 2033 | [[package]] 2034 | name = "wasm-bindgen-backend" 2035 | version = "0.2.83" 2036 | source = "registry+https://github.com/rust-lang/crates.io-index" 2037 | checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" 2038 | dependencies = [ 2039 | "bumpalo", 2040 | "log", 2041 | "once_cell", 2042 | "proc-macro2", 2043 | "quote", 2044 | "syn", 2045 | "wasm-bindgen-shared", 2046 | ] 2047 | 2048 | [[package]] 2049 | name = "wasm-bindgen-macro" 2050 | version = "0.2.83" 2051 | source = "registry+https://github.com/rust-lang/crates.io-index" 2052 | checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" 2053 | dependencies = [ 2054 | "quote", 2055 | "wasm-bindgen-macro-support", 2056 | ] 2057 | 2058 | [[package]] 2059 | name = "wasm-bindgen-macro-support" 2060 | version = "0.2.83" 2061 | source = "registry+https://github.com/rust-lang/crates.io-index" 2062 | checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" 2063 | dependencies = [ 2064 | "proc-macro2", 2065 | "quote", 2066 | "syn", 2067 | "wasm-bindgen-backend", 2068 | "wasm-bindgen-shared", 2069 | ] 2070 | 2071 | [[package]] 2072 | name = "wasm-bindgen-shared" 2073 | version = "0.2.83" 2074 | source = "registry+https://github.com/rust-lang/crates.io-index" 2075 | checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" 2076 | 2077 | [[package]] 2078 | name = "web-sys" 2079 | version = "0.3.60" 2080 | source = "registry+https://github.com/rust-lang/crates.io-index" 2081 | checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" 2082 | dependencies = [ 2083 | "js-sys", 2084 | "wasm-bindgen", 2085 | ] 2086 | 2087 | [[package]] 2088 | name = "whoami" 2089 | version = "1.2.3" 2090 | source = "registry+https://github.com/rust-lang/crates.io-index" 2091 | checksum = "d6631b6a2fd59b1841b622e8f1a7ad241ef0a46f2d580464ce8140ac94cbd571" 2092 | dependencies = [ 2093 | "bumpalo", 2094 | "wasm-bindgen", 2095 | "web-sys", 2096 | ] 2097 | 2098 | [[package]] 2099 | name = "winapi" 2100 | version = "0.3.9" 2101 | source = "registry+https://github.com/rust-lang/crates.io-index" 2102 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 2103 | dependencies = [ 2104 | "winapi-i686-pc-windows-gnu", 2105 | "winapi-x86_64-pc-windows-gnu", 2106 | ] 2107 | 2108 | [[package]] 2109 | name = "winapi-i686-pc-windows-gnu" 2110 | version = "0.4.0" 2111 | source = "registry+https://github.com/rust-lang/crates.io-index" 2112 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 2113 | 2114 | [[package]] 2115 | name = "winapi-util" 2116 | version = "0.1.5" 2117 | source = "registry+https://github.com/rust-lang/crates.io-index" 2118 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 2119 | dependencies = [ 2120 | "winapi", 2121 | ] 2122 | 2123 | [[package]] 2124 | name = "winapi-x86_64-pc-windows-gnu" 2125 | version = "0.4.0" 2126 | source = "registry+https://github.com/rust-lang/crates.io-index" 2127 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 2128 | 2129 | [[package]] 2130 | name = "windows-sys" 2131 | version = "0.36.1" 2132 | source = "registry+https://github.com/rust-lang/crates.io-index" 2133 | checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" 2134 | dependencies = [ 2135 | "windows_aarch64_msvc 0.36.1", 2136 | "windows_i686_gnu 0.36.1", 2137 | "windows_i686_msvc 0.36.1", 2138 | "windows_x86_64_gnu 0.36.1", 2139 | "windows_x86_64_msvc 0.36.1", 2140 | ] 2141 | 2142 | [[package]] 2143 | name = "windows-sys" 2144 | version = "0.42.0" 2145 | source = "registry+https://github.com/rust-lang/crates.io-index" 2146 | checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 2147 | dependencies = [ 2148 | "windows_aarch64_gnullvm", 2149 | "windows_aarch64_msvc 0.42.0", 2150 | "windows_i686_gnu 0.42.0", 2151 | "windows_i686_msvc 0.42.0", 2152 | "windows_x86_64_gnu 0.42.0", 2153 | "windows_x86_64_gnullvm", 2154 | "windows_x86_64_msvc 0.42.0", 2155 | ] 2156 | 2157 | [[package]] 2158 | name = "windows_aarch64_gnullvm" 2159 | version = "0.42.0" 2160 | source = "registry+https://github.com/rust-lang/crates.io-index" 2161 | checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" 2162 | 2163 | [[package]] 2164 | name = "windows_aarch64_msvc" 2165 | version = "0.36.1" 2166 | source = "registry+https://github.com/rust-lang/crates.io-index" 2167 | checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" 2168 | 2169 | [[package]] 2170 | name = "windows_aarch64_msvc" 2171 | version = "0.42.0" 2172 | source = "registry+https://github.com/rust-lang/crates.io-index" 2173 | checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" 2174 | 2175 | [[package]] 2176 | name = "windows_i686_gnu" 2177 | version = "0.36.1" 2178 | source = "registry+https://github.com/rust-lang/crates.io-index" 2179 | checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" 2180 | 2181 | [[package]] 2182 | name = "windows_i686_gnu" 2183 | version = "0.42.0" 2184 | source = "registry+https://github.com/rust-lang/crates.io-index" 2185 | checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" 2186 | 2187 | [[package]] 2188 | name = "windows_i686_msvc" 2189 | version = "0.36.1" 2190 | source = "registry+https://github.com/rust-lang/crates.io-index" 2191 | checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" 2192 | 2193 | [[package]] 2194 | name = "windows_i686_msvc" 2195 | version = "0.42.0" 2196 | source = "registry+https://github.com/rust-lang/crates.io-index" 2197 | checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" 2198 | 2199 | [[package]] 2200 | name = "windows_x86_64_gnu" 2201 | version = "0.36.1" 2202 | source = "registry+https://github.com/rust-lang/crates.io-index" 2203 | checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" 2204 | 2205 | [[package]] 2206 | name = "windows_x86_64_gnu" 2207 | version = "0.42.0" 2208 | source = "registry+https://github.com/rust-lang/crates.io-index" 2209 | checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" 2210 | 2211 | [[package]] 2212 | name = "windows_x86_64_gnullvm" 2213 | version = "0.42.0" 2214 | source = "registry+https://github.com/rust-lang/crates.io-index" 2215 | checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" 2216 | 2217 | [[package]] 2218 | name = "windows_x86_64_msvc" 2219 | version = "0.36.1" 2220 | source = "registry+https://github.com/rust-lang/crates.io-index" 2221 | checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" 2222 | 2223 | [[package]] 2224 | name = "windows_x86_64_msvc" 2225 | version = "0.42.0" 2226 | source = "registry+https://github.com/rust-lang/crates.io-index" 2227 | checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" 2228 | 2229 | [[package]] 2230 | name = "xtask" 2231 | version = "0.1.0" 2232 | dependencies = [ 2233 | "anyhow", 2234 | "clap", 2235 | ] 2236 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "template-web-service" 3 | version = "0.1.0" 4 | edition = "2021" 5 | license = "MIT" 6 | 7 | [dependencies] 8 | axum = { version = "0.6.1", features = ["http2"] } 9 | clap = { version = "4.0.19", features = ["derive"] } 10 | error-stack = "0.2.4" 11 | hyper = "0.14.22" 12 | sample-config = { git = "https://github.com/FlixCoder/sample-config", rev = "8d00c5772f04e1340034bb0d44c81f392633bb71", features = ["tracing", "yaml"] } 13 | serde = { version = "1.0.147", features = ["derive"] } 14 | serde_with = "2.0.1" 15 | serde_yaml = "0.9.14" 16 | sqlx = { version = "0.6.2", features = ["postgres", "runtime-tokio-native-tls"] } 17 | thiserror = "1.0.37" 18 | timed-locks = "0.1.1" 19 | tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread"] } 20 | tracing = "0.1.37" 21 | tracing-futures = "0.2.5" 22 | tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } 23 | 24 | [workspace] 25 | members = ["xtask"] 26 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim AS builder 2 | 3 | ENV PATH="/root/.cargo/bin:${PATH}" 4 | 5 | RUN apt -y update 6 | RUN apt -y upgrade 7 | RUN apt -y install build-essential curl libssl-dev cmake pkg-config 8 | RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y 9 | 10 | RUN mkdir /build 11 | WORKDIR /build 12 | COPY . /build 13 | RUN --mount=type=cache,target=/build/target \ 14 | --mount=type=cache,target=/root/.cargo/registry \ 15 | cargo build --release 16 | RUN --mount=type=cache,target=/build/target \ 17 | mv /build/target/release/template-web-service . 18 | 19 | FROM debian:bullseye-slim 20 | COPY --from=builder /build/template-web-service /opt/template-web-service 21 | EXPOSE 8080/tcp 22 | CMD [ "/opt/template-web-service", "spawn" ] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2022 stoically@proprietary.lol 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rust Template: Web service in 2022 2 | 3 | Simple web service template that tries to follow best practices in terms of cli, crates, 4 | patterns, configuration and file structure. The template wants to be as lean as possible, meaning that it does only the most basic wiring up of popular crates together with a container building xtask – something that tends to eat the first few hours of that New Shiny Side Project. 5 | 6 | If you spot anti-patterns, bad practices, outdated crates, missing features or anything really: feel free to open an issue. 7 | 8 | ## CLI 9 | 10 | **Features** 11 | 12 | - Spawn web service 13 | - Generate configuration file 14 | 15 | Run `cargo run -- help` to learn more. 16 | 17 | ## xtask 18 | 19 | **Features** 20 | 21 | - Build docker container 22 | 23 | Shell tasks following the [xtask pattern](https://github.com/matklad/cargo-xtask). 24 | 25 | Run `cargo xtask help` to learn more. 26 | 27 | ## Quick start 28 | 29 | 1. `cargo run -- config generate` and adjust the `database.uri` in the generated `config.yaml` 30 | 2. `cargo run -- spawn` 31 | 3. Visit `http://localhost:10100` 32 | 33 | ## Template crates 34 | 35 | - CLI: `clap` 36 | - Webserver / HTTP: `axum` / `hyper` 37 | - Database / Postgres: `sqlx` 38 | - Configuration: `sample-config` 39 | - Error handling: `error-stack` / `thiserror` 40 | - Async runtime: `tokio` 41 | - Tracing: `tracing` / `tracing-futures` / `tracing-subscriber` 42 | - De/serialization: `serde` / `serde-with` 43 | 44 | ## Template structure 45 | 46 | ```shell 47 | src/ 48 | cli.rs # CLI parsing and commands 49 | database.rs # Database handling 50 | config.rs # Configuration handling 51 | error.rs # Error types 52 | http.rs # Webserver / HTTP handling 53 | lib.rs # WebService struct 54 | main.rs # Binary 55 | state.rs # Shared state 56 | xtask/ 57 | main.rs # xtasks 58 | ``` 59 | -------------------------------------------------------------------------------- /migrations/20221106201421_initial.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | wrap_comments = true 2 | format_code_in_doc_comments = true 3 | imports_granularity = "Crate" 4 | group_imports = "StdExternalCrate" -------------------------------------------------------------------------------- /src/cli.rs: -------------------------------------------------------------------------------- 1 | //! CLI. 2 | 3 | use clap::{Parser, Subcommand}; 4 | 5 | /// Web service. 6 | #[derive(Debug, Parser)] 7 | #[command(author, version, about, long_about = None)] 8 | pub struct Args { 9 | #[command(subcommand)] 10 | pub command: Command, 11 | } 12 | 13 | /// Commands. 14 | #[derive(Debug, Subcommand)] 15 | pub enum Command { 16 | Config { 17 | #[clap(subcommand)] 18 | command: Config, 19 | }, 20 | /// Spawn the HTTP server with either default configuration or by reading 21 | /// `config.yaml` if it exists. 22 | Spawn, 23 | } 24 | 25 | /// Config commands. 26 | #[derive(Debug, Subcommand)] 27 | pub enum Config { 28 | /// Write default configuration to `config.yaml`. 29 | GenerateYaml, 30 | } 31 | 32 | pub fn parse() -> Args { 33 | Args::parse() 34 | } 35 | -------------------------------------------------------------------------------- /src/config.rs: -------------------------------------------------------------------------------- 1 | //! Configuration types. 2 | 3 | use std::net::SocketAddr; 4 | 5 | use error_stack::{IntoReport, Result, ResultExt}; 6 | use sample_config::SampleConfig; 7 | use serde::{Deserialize, Serialize}; 8 | use serde_with::{serde_as, DisplayFromStr}; 9 | use tracing_subscriber::filter::LevelFilter; 10 | 11 | use crate::Error; 12 | 13 | /// Configuration. 14 | /// 15 | /// We don't use the `config` crate because of type safety. See . 16 | // 17 | // TODO: Generate the setter methods via macro. 18 | #[derive(Debug, Default, Deserialize, Serialize, SampleConfig)] 19 | pub struct Config { 20 | pub http: HttpConfig, 21 | pub database: DatabaseConfig, 22 | pub log: LogConfig, 23 | } 24 | 25 | impl Config { 26 | /// Construct new [`Config`] with default values. 27 | #[tracing::instrument] 28 | pub fn new() -> Self { 29 | Self::default() 30 | } 31 | 32 | /// Construct new [`Config`] by reading a yaml file from disk. 33 | pub fn new_from_yaml(path: &str) -> Result { 34 | let config = serde_yaml::from_str( 35 | &std::fs::read_to_string(path) 36 | .into_report() 37 | .change_context(Error::Io)?, 38 | ) 39 | .into_report() 40 | .change_context(Error::SerdeYaml)?; 41 | 42 | Ok(config) 43 | } 44 | 45 | /// Write default configuration to `config.yaml` in the current directory. 46 | pub async fn generate_yaml() -> Result<(), Error> { 47 | let config = Self::default().generate_sample_yaml(); 48 | tokio::fs::write("./config.yaml", config) 49 | .await 50 | .into_report() 51 | .change_context(Error::Config)?; 52 | 53 | Ok(()) 54 | } 55 | } 56 | 57 | /// HTTP configuration. 58 | #[derive(Debug, Deserialize, Serialize, SampleConfig)] 59 | pub struct HttpConfig { 60 | pub addr: SocketAddr, 61 | } 62 | 63 | impl Default for HttpConfig { 64 | fn default() -> Self { 65 | Self { 66 | addr: ([0, 0, 0, 0], 10100).into(), 67 | } 68 | } 69 | } 70 | 71 | /// Database configuration. 72 | #[derive(Debug, Deserialize, Serialize, SampleConfig)] 73 | pub struct DatabaseConfig { 74 | pub uri: String, 75 | } 76 | 77 | impl Default for DatabaseConfig { 78 | fn default() -> Self { 79 | Self { 80 | uri: "postgresql://postgres:password@localhost:5432/template-web-service".to_owned(), 81 | } 82 | } 83 | } 84 | 85 | /// Logging configuration. 86 | #[serde_as] 87 | #[derive(Debug, Deserialize, Serialize, SampleConfig)] 88 | pub struct LogConfig { 89 | #[serde_as(as = "DisplayFromStr")] 90 | pub level_filter: LevelFilter, 91 | } 92 | 93 | impl Default for LogConfig { 94 | fn default() -> Self { 95 | Self { 96 | level_filter: LevelFilter::INFO, 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/database.rs: -------------------------------------------------------------------------------- 1 | //! Database. 2 | 3 | use error_stack::{IntoReport, Result, ResultExt}; 4 | use sqlx::{Pool, Postgres}; 5 | 6 | use crate::{Config, Error}; 7 | 8 | /// Connect pool and migrate database. 9 | pub async fn connect(config: &Config) -> Result, Error> { 10 | let pool = Pool::connect(&config.database.uri) 11 | .await 12 | .into_report() 13 | .change_context(Error::Sqlx)?; 14 | 15 | sqlx::migrate!("./migrations") 16 | .run(&pool) 17 | .await 18 | .into_report() 19 | .change_context(Error::Sqlx)?; 20 | 21 | Ok(pool) 22 | } 23 | -------------------------------------------------------------------------------- /src/error.rs: -------------------------------------------------------------------------------- 1 | //! Error types. 2 | 3 | /// Error. 4 | // 5 | // TODO: Better integration of `thiserror` into `error-stack` might be nice, or 6 | // similar features in `error-stack`. See 7 | // . 8 | #[derive(Debug, thiserror::Error)] 9 | pub enum Error { 10 | #[error("Config")] 11 | Config, 12 | 13 | #[error("Axum")] 14 | Axum, 15 | 16 | #[error("Hyper")] 17 | Hyper, 18 | 19 | #[error("Sqlx")] 20 | Sqlx, 21 | 22 | #[error("SerdeYaml")] 23 | SerdeYaml, 24 | 25 | #[error("Io")] 26 | Io, 27 | 28 | #[error("AddrParse")] 29 | AddrParse, 30 | } 31 | -------------------------------------------------------------------------------- /src/http.rs: -------------------------------------------------------------------------------- 1 | //! Webserver. 2 | 3 | use axum::{response::IntoResponse, routing::get, Router}; 4 | 5 | use crate::state::State; 6 | 7 | /// Main axum router. 8 | #[tracing::instrument(skip(state))] 9 | pub fn app(state: State) -> Router<()> { 10 | Router::new().route("/", get(handler)).with_state(state) 11 | } 12 | 13 | async fn handler(_state: axum::extract::State) -> impl IntoResponse { 14 | "Hello, World!" 15 | } 16 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | #![doc = include_str!("../README.md")] 2 | 3 | pub mod cli; 4 | pub mod config; 5 | mod database; 6 | mod error; 7 | mod http; 8 | mod state; 9 | 10 | use std::sync::Arc; 11 | 12 | use error_stack::{IntoReport, Result, ResultExt}; 13 | use timed_locks::RwLock; 14 | use tracing::info; 15 | use tracing_subscriber::EnvFilter; 16 | 17 | pub use crate::{ 18 | config::Config, 19 | error::Error, 20 | state::{InnerState, State}, 21 | }; 22 | 23 | /// Web service. 24 | pub struct WebService { 25 | state: State, 26 | } 27 | 28 | impl WebService { 29 | /// Create new [`WebService`] with default configuration. 30 | pub async fn new() -> Result { 31 | let config = Config::new(); 32 | Self::new_with_config(config).await 33 | } 34 | 35 | /// Create new [`WebService`] with the given configuration. 36 | pub async fn new_with_config(config: Config) -> Result { 37 | Self::tracing_subscriber(&config); 38 | info!("Starting."); 39 | info!("Connecting to database."); 40 | let pool = database::connect(&config).await?; 41 | Ok(Self { 42 | state: State { 43 | inner: Arc::new(RwLock::new(InnerState { config, pool })), 44 | }, 45 | }) 46 | } 47 | 48 | /// Initialize the tracing subscriber. 49 | #[tracing::instrument(skip_all)] 50 | fn tracing_subscriber(config: &Config) { 51 | tracing_subscriber::fmt() 52 | .with_file(true) 53 | .with_line_number(true) 54 | .with_env_filter( 55 | EnvFilter::builder() 56 | .with_default_directive(config.log.level_filter.into()) 57 | .from_env_lossy(), 58 | ) 59 | .init(); 60 | } 61 | 62 | /// Spawn the web service. 63 | /// 64 | /// Blocking call that tries to listen on the configured http socket 65 | /// address. 66 | #[tracing::instrument(skip(self))] 67 | pub async fn spawn(&self) -> Result<(), Error> { 68 | let addr = self.state.read().await.config.http.addr; 69 | 70 | info!("Listening on {}", addr); 71 | axum::Server::bind(&addr) 72 | .serve(http::app(self.state.clone()).into_make_service()) 73 | .await 74 | .into_report() 75 | .change_context(Error::Hyper)?; 76 | 77 | Ok(()) 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | 3 | use error_stack::Result; 4 | use template_web_service::{cli, Config, Error, WebService}; 5 | 6 | #[tokio::main] 7 | #[tracing::instrument] 8 | async fn main() -> Result<(), Error> { 9 | let args = cli::parse(); 10 | 11 | match args.command { 12 | cli::Command::Spawn => { 13 | let config_path = Path::new("./config.yaml"); 14 | let web_service = if config_path.exists() { 15 | let config = Config::new_from_yaml(&config_path.to_string_lossy())?; 16 | WebService::new_with_config(config).await? 17 | } else { 18 | WebService::new().await? 19 | }; 20 | web_service.spawn().await?; 21 | } 22 | cli::Command::Config { command } => match command { 23 | cli::Config::GenerateYaml => Config::generate_yaml().await?, 24 | }, 25 | } 26 | 27 | Ok(()) 28 | } 29 | -------------------------------------------------------------------------------- /src/state.rs: -------------------------------------------------------------------------------- 1 | use std::{ops::Deref, sync::Arc}; 2 | 3 | use sqlx::{Pool, Postgres}; 4 | use timed_locks::RwLock; 5 | 6 | use crate::Config; 7 | 8 | /// Shared state. 9 | #[derive(Clone)] 10 | pub struct State { 11 | pub inner: Arc>, 12 | } 13 | 14 | impl Deref for State { 15 | type Target = Arc>; 16 | 17 | fn deref(&self) -> &Self::Target { 18 | &self.inner 19 | } 20 | } 21 | 22 | pub struct InnerState { 23 | /// Configuration. 24 | pub config: Config, 25 | /// Database pool. 26 | pub pool: Pool, 27 | } 28 | -------------------------------------------------------------------------------- /xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "xtask" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1.0.66" 8 | clap = { version = "4.0.19", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | use clap::{Parser, Subcommand}; 2 | 3 | /// Shell tasks following the xtask pattern. 4 | /// 5 | /// See https://github.com/matklad/cargo-xtask. 6 | #[derive(Debug, Parser)] 7 | #[command(author, version, about, long_about = None)] 8 | pub struct Args { 9 | #[command(subcommand)] 10 | pub command: Command, 11 | } 12 | 13 | /// Commands. 14 | #[derive(Debug, Subcommand)] 15 | pub enum Command { 16 | Docker { 17 | #[clap(subcommand)] 18 | command: Docker, 19 | }, 20 | } 21 | 22 | /// Docker commands. 23 | #[derive(Debug, Subcommand)] 24 | pub enum Docker { 25 | /// Build the docker image. Requires buildkit. See https://docs.docker.com/build/buildkit/#getting-started. 26 | Build, 27 | } 28 | 29 | fn main() -> anyhow::Result<()> { 30 | let args = Args::parse(); 31 | 32 | match args.command { 33 | Command::Docker { command } => match command { 34 | Docker::Build => { 35 | std::process::Command::new("docker") 36 | .args(&["build", "--rm", "-t", "template-web-service:latest", "."]) 37 | .spawn()? 38 | .wait_with_output()?; 39 | } 40 | }, 41 | } 42 | 43 | Ok(()) 44 | } 45 | --------------------------------------------------------------------------------