mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-12-18 14:06:37 +00:00
Remove anyhow.
This commit is contained in:
parent
cfb11a798d
commit
ff99488030
5 changed files with 4 additions and 18 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -334,12 +334,6 @@ dependencies = [
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anyhow"
|
|
||||||
version = "1.0.33"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a1fd36ffbb1fb7c834eac128ea8d0e310c5aeb635548f9d58861e1308d46e71c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arc-swap"
|
name = "arc-swap"
|
||||||
version = "0.4.7"
|
version = "0.4.7"
|
||||||
|
@ -529,7 +523,6 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-rt",
|
"actix-rt",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"anyhow",
|
|
||||||
"chrono",
|
"chrono",
|
||||||
"config",
|
"config",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
@ -545,7 +538,6 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-rt",
|
"actix-rt",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"anyhow",
|
|
||||||
"chrono",
|
"chrono",
|
||||||
"config",
|
"config",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
|
|
@ -19,7 +19,6 @@ tokio = "0.2.22"
|
||||||
serde = "1.0.115"
|
serde = "1.0.115"
|
||||||
config = { version = "0.10.1", default-features = false, features = ["yaml"] }
|
config = { version = "0.10.1", default-features = false, features = ["yaml"] }
|
||||||
sqlx = { version = "0.4.0-beta.1", default-features = false, features = [ "runtime-tokio", "macros", "postgres", "uuid", "chrono", "migrate"] }
|
sqlx = { version = "0.4.0-beta.1", default-features = false, features = [ "runtime-tokio", "macros", "postgres", "uuid", "chrono", "migrate"] }
|
||||||
anyhow = "1.0.32"
|
|
||||||
uuid = { version = "0.8.1", features = ["v4"] }
|
uuid = { version = "0.8.1", features = ["v4"] }
|
||||||
chrono = "0.4.15"
|
chrono = "0.4.15"
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
use anyhow::Context;
|
|
||||||
use chapter03_1::configuration::get_configuration;
|
use chapter03_1::configuration::get_configuration;
|
||||||
use chapter03_1::startup::run;
|
use chapter03_1::startup::run;
|
||||||
use sqlx::postgres::PgPool;
|
use sqlx::postgres::PgPool;
|
||||||
use std::net::TcpListener;
|
use std::net::TcpListener;
|
||||||
|
|
||||||
#[actix_rt::main]
|
#[actix_rt::main]
|
||||||
async fn main() -> Result<(), anyhow::Error> {
|
async fn main() -> std::io::Result<()> {
|
||||||
let configuration = get_configuration().expect("Failed to read configuration.");
|
let configuration = get_configuration().expect("Failed to read configuration.");
|
||||||
let connection_pool = PgPool::connect(&configuration.database.connection_string())
|
let connection_pool = PgPool::connect(&configuration.database.connection_string())
|
||||||
.await
|
.await
|
||||||
.map_err(anyhow::Error::from)
|
.expect("Failed to connect to Postgres.");
|
||||||
.with_context(|| "Failed to connect to Postgres.")?;
|
|
||||||
|
|
||||||
// Here we choose to bind explicitly to localhost, 127.0.0.1, for security
|
// Here we choose to bind explicitly to localhost, 127.0.0.1, for security
|
||||||
// reasons. This binding may cause issues in some environments. For example,
|
// reasons. This binding may cause issues in some environments. For example,
|
||||||
|
|
|
@ -19,7 +19,6 @@ tokio = "0.2.22"
|
||||||
serde = "1.0.115"
|
serde = "1.0.115"
|
||||||
config = { version = "0.10.1", default-features = false, features = ["yaml"] }
|
config = { version = "0.10.1", default-features = false, features = ["yaml"] }
|
||||||
sqlx = { version = "0.4.0-beta.1", default-features = false, features = [ "runtime-tokio", "macros", "postgres", "uuid", "chrono", "migrate"] }
|
sqlx = { version = "0.4.0-beta.1", default-features = false, features = [ "runtime-tokio", "macros", "postgres", "uuid", "chrono", "migrate"] }
|
||||||
anyhow = "1.0.32"
|
|
||||||
uuid = { version = "0.8.1", features = ["v4"] }
|
uuid = { version = "0.8.1", features = ["v4"] }
|
||||||
chrono = "0.4.15"
|
chrono = "0.4.15"
|
||||||
tracing = "0.1.19"
|
tracing = "0.1.19"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use anyhow::Context;
|
|
||||||
use chapter04::configuration::get_configuration;
|
use chapter04::configuration::get_configuration;
|
||||||
use chapter04::startup::run;
|
use chapter04::startup::run;
|
||||||
use chapter04::telemetry::{get_subscriber, init_subscriber};
|
use chapter04::telemetry::{get_subscriber, init_subscriber};
|
||||||
|
@ -6,15 +5,14 @@ use sqlx::postgres::PgPool;
|
||||||
use std::net::TcpListener;
|
use std::net::TcpListener;
|
||||||
|
|
||||||
#[actix_rt::main]
|
#[actix_rt::main]
|
||||||
async fn main() -> Result<(), anyhow::Error> {
|
async fn main() -> std::io::Result<()> {
|
||||||
let subscriber = get_subscriber("zero2prod".into(), "info".into());
|
let subscriber = get_subscriber("zero2prod".into(), "info".into());
|
||||||
init_subscriber(subscriber);
|
init_subscriber(subscriber);
|
||||||
|
|
||||||
let configuration = get_configuration().expect("Failed to read configuration.");
|
let configuration = get_configuration().expect("Failed to read configuration.");
|
||||||
let connection_pool = PgPool::connect(&configuration.database.connection_string())
|
let connection_pool = PgPool::connect(&configuration.database.connection_string())
|
||||||
.await
|
.await
|
||||||
.map_err(anyhow::Error::from)
|
.expect("Failed to connect to Postgres.");
|
||||||
.with_context(|| "Failed to connect to Postgres.")?;
|
|
||||||
|
|
||||||
// Here we choose to bind explicitly to localhost, 127.0.0.1, for security
|
// Here we choose to bind explicitly to localhost, 127.0.0.1, for security
|
||||||
// reasons. This binding may cause issues in some environments. For example,
|
// reasons. This binding may cause issues in some environments. For example,
|
||||||
|
|
Loading…
Reference in a new issue