fix(config): inject config in rocket managed state
https://github.com/mozilla/fxa-email-service/pull/66 r=philbooth
This commit is contained in:
Родитель
5986e841ce
Коммит
50f8d523a4
|
@ -144,7 +144,7 @@ dependencies = [
|
|||
"nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde-hjson 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -362,7 +362,7 @@ dependencies = [
|
|||
"sendgrid 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"validator 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"validator_derive 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -429,7 +429,7 @@ dependencies = [
|
|||
"httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -532,7 +532,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "libflate"
|
||||
version = "0.1.14"
|
||||
version = "0.1.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"adler32 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -559,12 +559,12 @@ name = "log"
|
|||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -647,7 +647,7 @@ dependencies = [
|
|||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -740,12 +740,12 @@ dependencies = [
|
|||
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.9.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.9.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.32"
|
||||
version = "0.9.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -978,12 +978,12 @@ dependencies = [
|
|||
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper-tls 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libflate 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libflate 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime_guess 2.0.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"native-tls 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_urlencoded 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1047,7 +1047,7 @@ dependencies = [
|
|||
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rocket 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1062,7 +1062,7 @@ dependencies = [
|
|||
"hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper-tls 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rusoto_credential 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1083,7 +1083,7 @@ dependencies = [
|
|||
"hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper-tls 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1191,7 +1191,7 @@ dependencies = [
|
|||
"reqwest 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1229,7 +1229,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.19"
|
||||
version = "1.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1369,7 +1369,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1379,8 +1379,8 @@ dependencies = [
|
|||
"tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-reactor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-tcp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-timer 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-udp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1392,14 +1392,14 @@ dependencies = [
|
|||
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-reactor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-timer 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1417,7 +1417,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
dependencies = [
|
||||
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1427,7 +1427,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
dependencies = [
|
||||
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1453,7 +1453,7 @@ version = "0.1.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1483,12 +1483,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tokio-threadpool"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam-deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1496,7 +1496,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tokio-timer"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1521,7 +1521,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
dependencies = [
|
||||
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-reactor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1646,7 +1646,7 @@ dependencies = [
|
|||
"regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1682,7 +1682,7 @@ version = "0.0.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"try-lock 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1809,11 +1809,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e6412c5e2ad9584b0b8e979393122026cdd6d2a80b933f890dcd694ddbe73739"
|
||||
"checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef"
|
||||
"checksum libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b685088df2b950fccadf07a7187c8ef846a959c142338a48f9dc0b94517eb5f1"
|
||||
"checksum libflate 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1a429b86418868c7ea91ee50e9170683f47fd9d94f5375438ec86ec3adb74e8e"
|
||||
"checksum libflate 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f70a41040e4ed915b462ffb9c8dd20ece3700565aa5e2e163288a0f7ca00487a"
|
||||
"checksum linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd"
|
||||
"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
|
||||
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
|
||||
"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"
|
||||
"checksum log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6fddaa003a65722a7fb9e26b0ce95921fe4ba590542ced664d8ce2fa26f9f3ac"
|
||||
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
|
||||
"checksum md5 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "daa1004633f76cdcd5a9d83ffcfe615e30ca7a2a638fcc8b8039a2dac21289d7"
|
||||
"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
|
||||
|
@ -1834,7 +1834,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775393e285254d2f5004596d69bb8bc1149754570dcc08cf30cabeba67955e28"
|
||||
"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"
|
||||
"checksum openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a3605c298474a3aa69de92d21139fb5e2a81688d308262359d85cdd0d12a7985"
|
||||
"checksum openssl-sys 0.9.32 (registry+https://github.com/rust-lang/crates.io-index)" = "55ab11bb4f1874c116d57ff27d8bfe8252dafc567384334b7c58339ad57e0010"
|
||||
"checksum openssl-sys 0.9.33 (registry+https://github.com/rust-lang/crates.io-index)" = "d8abc04833dcedef24221a91852931df2f63e3369ae003134e70aff3645775cc"
|
||||
"checksum ordermap 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b81cf3b8cb96aa0e73bbedfcdc9708d09fec2854ba8d474be4e6f666d7379e8b"
|
||||
"checksum pear 0.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "2d0b966f9b387335fedc3546471db37b6e02430c180878015df1eaa3e62da289"
|
||||
"checksum pear_codegen 0.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "3a97c944f71801ef6b36bbf47a98b24167795d74bb8678f013d60d312bfc795c"
|
||||
|
@ -1885,7 +1885,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)" = "e9a2d9a9ac5120e0f768801ca2b58ad6eec929dc9d1d616c162f208869c2ce95"
|
||||
"checksum serde-hjson 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a2376ebb8976138927f48b49588ef73cde2f6591b8b3df22f4063e0f27b9bec"
|
||||
"checksum serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)" = "0a90213fa7e0f5eac3f7afe2d5ff6b088af515052cc7303bd68c7e3b91a3fb79"
|
||||
"checksum serde_json 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "93aee34bb692dde91e602871bc792dd319e489c7308cdbbe5f27cf27c64280f5"
|
||||
"checksum serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "fc97cccc2959f39984524026d760c08ef0dd5f0f5948c8d31797dbfae458c875"
|
||||
"checksum serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5"
|
||||
"checksum serde_urlencoded 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e703cef904312097cfceab9ce131ff6bbe09e8c964a0703345a5f49238757bc1"
|
||||
"checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0"
|
||||
|
@ -1903,7 +1903,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5"
|
||||
"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"
|
||||
"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b"
|
||||
"checksum tokio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d00555353b013e170ed8bc4e13f648a317d1fd12157dbcae13f7013f6cf29f5"
|
||||
"checksum tokio 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8ee337e5f4e501fc32966fec6fe0ca0cc1c237b0b1b14a335f8bfe3c5f06e286"
|
||||
"checksum tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "aeeffbbb94209023feaef3c196a41cbcdafa06b4a6f893f68779bb5e53796f71"
|
||||
"checksum tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8cac2a7883ff3567e9d66bb09100d09b33d90311feca0206c7ca034bc0c55113"
|
||||
"checksum tokio-fs 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "76766830bbf9a2d5bfb50c95350d56a2e79e2c80f675967fff448bc615899708"
|
||||
|
@ -1912,8 +1912,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum tokio-reactor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3cedc8e5af5131dc3423ffa4f877cce78ad25259a9a62de0613735a13ebc64b"
|
||||
"checksum tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "24da22d077e0f15f55162bdbdc661228c1581892f52074fb242678d015b45162"
|
||||
"checksum tokio-tcp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec9b094851aadd2caf83ba3ad8e8c4ce65a42104f7b94d9e6550023f0407853f"
|
||||
"checksum tokio-threadpool 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5783254b10c7c84a56f62c74766ef7e5b83d1f13053218c7cab8d3f2c826fa0e"
|
||||
"checksum tokio-timer 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535fed0ccee189f3d48447587697ba3fd234b3dbbb091f0ec4613ddfec0a7c4c"
|
||||
"checksum tokio-threadpool 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c3873a6d8d0b636e024e77b9a82eaab6739578a06189ecd0e731c7308fbc5d"
|
||||
"checksum tokio-timer 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "028b94314065b90f026a21826cffd62a4e40a92cda3e5c069cc7b02e5945f5e9"
|
||||
"checksum tokio-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "772f4b04e560117fe3b0a53e490c16ddc8ba6ec437015d91fa385564996ed913"
|
||||
"checksum tokio-udp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "137bda266504893ac4774e0ec4c2108f7ccdbcb7ac8dced6305fe9e4e0b5041a"
|
||||
"checksum toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a0263c6c02c4db6c8f7681f9fd35e90de799ebd4cfdeab77a38f4ff6b3d8c0d9"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
use std::{
|
||||
error::Error, fmt::{self, Display, Formatter},
|
||||
error::Error,
|
||||
fmt::{self, Display, Formatter},
|
||||
};
|
||||
|
||||
use hex;
|
||||
|
@ -211,7 +212,7 @@ impl DbUrls {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait Db {
|
||||
pub trait Db: Sync {
|
||||
fn get_bounces(&self, address: &str) -> Result<Vec<BounceRecord>, DbError>;
|
||||
|
||||
fn create_bounce(
|
||||
|
@ -273,5 +274,3 @@ impl Db for DbClient {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Sync for DbClient {}
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
use std::{
|
||||
collections::HashMap, error::Error, fmt::{self, Display, Formatter}, time::SystemTime,
|
||||
collections::HashMap,
|
||||
error::Error,
|
||||
fmt::{self, Display, Formatter},
|
||||
time::SystemTime,
|
||||
};
|
||||
|
||||
use rocket::{http::Status, response::Failure};
|
||||
|
@ -74,16 +77,19 @@ impl From<BounceError> for Failure {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Bounces<'a> {
|
||||
db: Box<&'a Db>,
|
||||
limits: &'a BounceLimits,
|
||||
pub struct Bounces<D: Db> {
|
||||
db: D,
|
||||
limits: BounceLimits,
|
||||
}
|
||||
|
||||
impl<'a> Bounces<'a> {
|
||||
pub fn new(settings: &'a Settings, db: Box<&'a Db>) -> Bounces<'a> {
|
||||
impl<D> Bounces<D>
|
||||
where
|
||||
D: Db,
|
||||
{
|
||||
pub fn new(settings: &Settings, db: D) -> Bounces<D> {
|
||||
Bounces {
|
||||
db,
|
||||
limits: &settings.bouncelimits,
|
||||
limits: settings.bouncelimits.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +121,7 @@ impl<'a> Bounces<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl<'a> Sync for Bounces<'a> {}
|
||||
unsafe impl<D> Sync for Bounces<D> where D: Db {}
|
||||
|
||||
fn is_bounce_violation(count: u8, created_at: u64, now: u64, limits: &Vec<BounceLimit>) -> bool {
|
||||
for limit in limits.iter() {
|
||||
|
|
|
@ -31,7 +31,7 @@ fn check_no_bounces() {
|
|||
]
|
||||
}));
|
||||
let db = DbMockNoBounce;
|
||||
let bounces = Bounces::new(&settings, Box::new(&db));
|
||||
let bounces = Bounces::new(&settings, db);
|
||||
if let Err(error) = bounces.check("foo@example.com") {
|
||||
assert!(false, error.description().to_string());
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ fn check_soft_bounce() {
|
|||
"complaint": []
|
||||
}));
|
||||
let db = DbMockBounceSoft;
|
||||
let bounces = Bounces::new(&settings, Box::new(&db));
|
||||
let bounces = Bounces::new(&settings, db);
|
||||
match bounces.check("foo@example.com") {
|
||||
Ok(_) => assert!(false, "Bounces::check should have failed"),
|
||||
Err(error) => {
|
||||
|
@ -134,7 +134,7 @@ fn check_hard_bounce() {
|
|||
"complaint": []
|
||||
}));
|
||||
let db = DbMockBounceHard;
|
||||
let bounces = Bounces::new(&settings, Box::new(&db));
|
||||
let bounces = Bounces::new(&settings, db);
|
||||
match bounces.check("bar@example.com") {
|
||||
Ok(_) => assert!(false, "Bounces::check should have failed"),
|
||||
Err(error) => {
|
||||
|
@ -179,7 +179,7 @@ fn check_complaint() {
|
|||
]
|
||||
}));
|
||||
let db = DbMockComplaint;
|
||||
let bounces = Bounces::new(&settings, Box::new(&db));
|
||||
let bounces = Bounces::new(&settings, db);
|
||||
match bounces.check("baz@example.com") {
|
||||
Ok(_) => assert!(false, "Bounces::check should have failed"),
|
||||
Err(error) => {
|
||||
|
@ -228,7 +228,7 @@ fn check_db_error() {
|
|||
]
|
||||
}));
|
||||
let db = DbMockError;
|
||||
let bounces = Bounces::new(&settings, Box::new(&db));
|
||||
let bounces = Bounces::new(&settings, db);
|
||||
match bounces.check("foo@example.com") {
|
||||
Ok(_) => assert!(false, "Bounces::check should have failed"),
|
||||
Err(error) => {
|
||||
|
@ -266,7 +266,7 @@ fn check_no_bounces_with_nonzero_limits() {
|
|||
]
|
||||
}));
|
||||
let db = DbMockNoBounceWithNonZeroLimits;
|
||||
let bounces = Bounces::new(&settings, Box::new(&db));
|
||||
let bounces = Bounces::new(&settings, db);
|
||||
if let Err(error) = bounces.check("foo@example.com") {
|
||||
assert!(false, error.description().to_string());
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ fn check_bounce_with_multiple_limits() {
|
|||
"complaint": []
|
||||
}));
|
||||
let db = DbMockBounceWithMultipleLimits;
|
||||
let bounces = Bounces::new(&settings, Box::new(&db));
|
||||
let bounces = Bounces::new(&settings, db);
|
||||
match bounces.check("foo@example.com") {
|
||||
Ok(_) => assert!(false, "Bounces::check should have failed"),
|
||||
Err(error) => {
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
use std::{
|
||||
convert::{From, TryFrom}, error::Error, fmt::{self, Display, Formatter},
|
||||
convert::{From, TryFrom},
|
||||
error::Error,
|
||||
fmt::{self, Display, Formatter},
|
||||
};
|
||||
|
||||
use regex::Regex;
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
use std::{
|
||||
boxed::Box, collections::HashMap, error::Error, fmt::{self, Display, Formatter},
|
||||
boxed::Box,
|
||||
collections::HashMap,
|
||||
error::Error,
|
||||
fmt::{self, Display, Formatter},
|
||||
};
|
||||
|
||||
use self::{
|
||||
|
@ -49,14 +52,14 @@ impl Display for ProviderError {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Providers<'s> {
|
||||
default_provider: &'s str,
|
||||
providers: HashMap<String, Box<Provider + 's>>,
|
||||
pub struct Providers {
|
||||
default_provider: String,
|
||||
providers: HashMap<String, Box<Provider>>,
|
||||
}
|
||||
|
||||
impl<'s> Providers<'s> {
|
||||
pub fn new(settings: &'s Settings) -> Providers {
|
||||
let mut providers: HashMap<String, Box<Provider + 's>> = HashMap::new();
|
||||
impl Providers {
|
||||
pub fn new(settings: &Settings) -> Providers {
|
||||
let mut providers: HashMap<String, Box<Provider>> = HashMap::new();
|
||||
|
||||
providers.insert(String::from("mock"), Box::new(Mock));
|
||||
providers.insert(String::from("ses"), Box::new(Ses::new(settings)));
|
||||
|
@ -69,7 +72,7 @@ impl<'s> Providers<'s> {
|
|||
}
|
||||
|
||||
Providers {
|
||||
default_provider: &settings.provider,
|
||||
default_provider: settings.provider.clone(),
|
||||
providers,
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +86,7 @@ impl<'s> Providers<'s> {
|
|||
body_html: Option<&str>,
|
||||
provider_id: Option<&str>,
|
||||
) -> Result<String, ProviderError> {
|
||||
let resolved_provider_id = provider_id.unwrap_or(self.default_provider);
|
||||
let resolved_provider_id = provider_id.unwrap_or(&self.default_provider);
|
||||
|
||||
self.providers
|
||||
.get(resolved_provider_id)
|
||||
|
@ -96,4 +99,6 @@ impl<'s> Providers<'s> {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl<'s> Sync for Providers<'s> {}
|
||||
unsafe impl Sync for Providers {}
|
||||
|
||||
unsafe impl Send for Providers {}
|
||||
|
|
|
@ -15,24 +15,21 @@ use sendgrid::{
|
|||
use super::{Provider, ProviderError};
|
||||
use settings::{Sender, Sendgrid as SendgridSettings, Settings};
|
||||
|
||||
pub struct SendgridProvider<'s> {
|
||||
pub struct SendgridProvider {
|
||||
client: Client,
|
||||
sender: &'s Sender,
|
||||
sender: Sender,
|
||||
}
|
||||
|
||||
impl<'s> SendgridProvider<'s> {
|
||||
pub fn new(
|
||||
sendgrid_settings: &SendgridSettings,
|
||||
settings: &'s Settings,
|
||||
) -> SendgridProvider<'s> {
|
||||
impl SendgridProvider {
|
||||
pub fn new(sendgrid_settings: &SendgridSettings, settings: &Settings) -> SendgridProvider {
|
||||
SendgridProvider {
|
||||
client: Client::new(sendgrid_settings.key.clone()),
|
||||
sender: &settings.sender,
|
||||
sender: settings.sender.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> Provider for SendgridProvider<'s> {
|
||||
impl Provider for SendgridProvider {
|
||||
fn send(
|
||||
&self,
|
||||
to: &str,
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
use std::{
|
||||
boxed::Box, error::Error, fmt::{self, Debug, Display, Formatter},
|
||||
boxed::Box,
|
||||
error::Error,
|
||||
fmt::{self, Debug, Display, Formatter},
|
||||
};
|
||||
|
||||
use futures::future::{self, Future};
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
use std::{
|
||||
boxed::Box, fmt::{self, Debug, Formatter},
|
||||
boxed::Box,
|
||||
fmt::{self, Debug, Formatter},
|
||||
};
|
||||
|
||||
use futures::future::{self, Future};
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
use rocket::{
|
||||
data::{self, FromData}, http::Status, response::Failure, Data, Outcome, Request,
|
||||
data::{self, FromData},
|
||||
http::Status,
|
||||
response::Failure,
|
||||
Data, Outcome, Request, State,
|
||||
};
|
||||
use rocket_contrib::{Json, Value};
|
||||
|
||||
|
@ -11,19 +14,11 @@ use auth_db::DbClient;
|
|||
use bounces::Bounces;
|
||||
use deserialize;
|
||||
use providers::Providers;
|
||||
use settings::Settings;
|
||||
use validate;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test;
|
||||
|
||||
lazy_static! {
|
||||
static ref SETTINGS: Settings = Settings::new().expect("config error");
|
||||
static ref DB: DbClient = DbClient::new(&SETTINGS);
|
||||
static ref BOUNCES: Bounces<'static> = Bounces::new(&SETTINGS, Box::new(&*DB));
|
||||
static ref PROVIDERS: Providers<'static> = Providers::new(&SETTINGS);
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Body {
|
||||
text: String,
|
||||
|
@ -83,14 +78,18 @@ fn fail() -> data::Outcome<Email, ()> {
|
|||
}
|
||||
|
||||
#[post("/send", format = "application/json", data = "<email>")]
|
||||
fn handler(email: Email) -> Result<Json<Value>, Failure> {
|
||||
fn handler(
|
||||
email: Email,
|
||||
bounces: State<Bounces<DbClient>>,
|
||||
providers: State<Providers>,
|
||||
) -> Result<Json<Value>, Failure> {
|
||||
let to = email.to.as_ref();
|
||||
BOUNCES.check(to)?;
|
||||
bounces.check(to)?;
|
||||
|
||||
let cc = if let Some(ref cc) = email.cc {
|
||||
let mut refs = Vec::new();
|
||||
for address in cc.iter() {
|
||||
BOUNCES.check(address)?;
|
||||
bounces.check(address)?;
|
||||
refs.push(address.as_ref());
|
||||
}
|
||||
refs
|
||||
|
@ -98,7 +97,7 @@ fn handler(email: Email) -> Result<Json<Value>, Failure> {
|
|||
Vec::new()
|
||||
};
|
||||
|
||||
PROVIDERS
|
||||
providers
|
||||
.send(
|
||||
email.to.as_ref(),
|
||||
cc.as_ref(),
|
||||
|
|
|
@ -3,14 +3,26 @@
|
|||
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
use rocket::{
|
||||
self, http::{ContentType, Status}, local::Client,
|
||||
self,
|
||||
http::{ContentType, Status},
|
||||
local::Client,
|
||||
};
|
||||
use serde_json;
|
||||
|
||||
use app_errors::{self, ApplicationError};
|
||||
use auth_db::DbClient;
|
||||
use bounces::Bounces;
|
||||
use providers::Providers;
|
||||
use settings::Settings;
|
||||
|
||||
fn setup() -> Client {
|
||||
let settings = Settings::new().unwrap();
|
||||
let db = DbClient::new(&settings);
|
||||
let bounces = Bounces::new(&settings, db);
|
||||
let providers = Providers::new(&settings);
|
||||
let server = rocket::ignite()
|
||||
.manage(bounces)
|
||||
.manage(providers)
|
||||
.mount("/", routes![super::handler])
|
||||
.catch(errors![
|
||||
app_errors::bad_request,
|
||||
|
|
|
@ -36,8 +36,20 @@ mod send;
|
|||
mod settings;
|
||||
mod validate;
|
||||
|
||||
use auth_db::DbClient;
|
||||
use bounces::Bounces;
|
||||
use providers::Providers;
|
||||
use settings::Settings;
|
||||
|
||||
fn main() {
|
||||
let settings = Settings::new().expect("Config error.");
|
||||
let db = DbClient::new(&settings);
|
||||
let bounces = Bounces::new(&settings, db);
|
||||
let providers = Providers::new(&settings);
|
||||
|
||||
rocket::ignite()
|
||||
.manage(bounces)
|
||||
.manage(providers)
|
||||
.mount("/", routes![send::handler])
|
||||
.catch(errors![
|
||||
app_errors::bad_request,
|
||||
|
|
|
@ -33,14 +33,14 @@ pub struct AwsKeys {
|
|||
pub secret: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize)]
|
||||
pub struct BounceLimit {
|
||||
#[serde(deserialize_with = "deserialize::duration")]
|
||||
pub period: u64,
|
||||
pub limit: u8,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize)]
|
||||
pub struct BounceLimits {
|
||||
pub enabled: bool,
|
||||
pub complaint: Vec<BounceLimit>,
|
||||
|
@ -48,7 +48,7 @@ pub struct BounceLimits {
|
|||
pub soft: Vec<BounceLimit>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize)]
|
||||
pub struct Sender {
|
||||
#[serde(deserialize_with = "deserialize::email_address")]
|
||||
pub address: String,
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
use std::{
|
||||
collections::{HashMap, HashSet}, env, error::Error,
|
||||
collections::{HashMap, HashSet},
|
||||
env,
|
||||
error::Error,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
|
Загрузка…
Ссылка в новой задаче