mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-11-21 16:21:01 +00:00
Update all dependencies
This commit is contained in:
parent
6bd30650cb
commit
ac8a60b4c5
6 changed files with 463 additions and 759 deletions
1169
Cargo.lock
generated
1169
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
20
Cargo.toml
20
Cargo.toml
|
@ -16,9 +16,9 @@ name = "zero2prod"
|
|||
actix-web = "4"
|
||||
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
|
||||
serde = "1.0.115"
|
||||
config = { version = "0.11", default-features = false, features = ["yaml"] }
|
||||
sqlx = { version = "0.5.5", default-features = false, features = [ "runtime-actix-rustls", "macros", "postgres", "uuid", "chrono", "migrate", "offline"] }
|
||||
uuid = { version = "0.8.1", features = ["v4", "serde"] }
|
||||
config = { version = "0.13", default-features = false, features = ["yaml"] }
|
||||
sqlx = { version = "0.6", default-features = false, features = ["runtime-actix-rustls", "macros", "postgres", "uuid", "chrono", "migrate", "offline"] }
|
||||
uuid = { version = "1", features = ["v4", "serde"] }
|
||||
chrono = "0.4.15"
|
||||
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls", "cookies"] }
|
||||
log = "0.4"
|
||||
|
@ -29,19 +29,17 @@ tracing-log = "0.1.1"
|
|||
thiserror = "1.0.24"
|
||||
serde-aux = "3"
|
||||
unicode-segmentation = "1.7.1"
|
||||
validator = "0.14.0"
|
||||
rand = { version = "0.8", features=["std_rng"] }
|
||||
anyhow = "1.0.40"
|
||||
base64 = "0.13.0"
|
||||
argon2 = { version = "0.3", features = ["std"] }
|
||||
tracing-actix-web = "0.5"
|
||||
argon2 = { version = "0.4", features = ["std"] }
|
||||
validator = "0.15.0"
|
||||
tracing-actix-web = "0.6"
|
||||
secrecy = { version = "0.8", features = ["serde"] }
|
||||
urlencoding = "2"
|
||||
htmlescape = "0.3"
|
||||
actix-web-flash-messages = { version = "0.3", features = ["cookies"] }
|
||||
actix-session = { git = "https://github.com/actix/actix-extras", branch = "master", features = ["redis-rs-tls-session"] }
|
||||
actix-web-flash-messages = { version = "0.4", features = ["cookies"] }
|
||||
actix-session = { version = "0.6", features = ["redis-rs-tls-session"] }
|
||||
serde_json = "1"
|
||||
actix-web-lab = "0.15"
|
||||
actix-web-lab = "0.16"
|
||||
|
||||
[dev-dependencies]
|
||||
once_cell = "1.7.2"
|
||||
|
|
|
@ -10,7 +10,7 @@ fi
|
|||
if ! [ -x "$(command -v sqlx)" ]; then
|
||||
echo >&2 "Error: sqlx is not installed."
|
||||
echo >&2 "Use:"
|
||||
echo >&2 " cargo install --version=0.5.5 sqlx-cli --no-default-features --features postgres"
|
||||
echo >&2 " cargo install --version=0.6.0 sqlx-cli --no-default-features --features postgres"
|
||||
echo >&2 "to install it."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -19,7 +19,7 @@ fi
|
|||
DB_USER="${POSTGRES_USER:=postgres}"
|
||||
# Check if a custom password has been set, otherwise default to 'password'
|
||||
DB_PASSWORD="${POSTGRES_PASSWORD:=password}"
|
||||
# Check if a custom password has been set, otherwise default to 'newsletter'
|
||||
# Check if a custom database name has been set, otherwise default to 'newsletter'
|
||||
DB_NAME="${POSTGRES_DB:=newsletter}"
|
||||
# Check if a custom port has been set, otherwise default to '5432'
|
||||
DB_PORT="${POSTGRES_PORT:=5432}"
|
||||
|
|
|
@ -87,30 +87,25 @@ impl EmailClientSettings {
|
|||
}
|
||||
|
||||
pub fn get_configuration() -> Result<Settings, config::ConfigError> {
|
||||
let mut settings = config::Config::default();
|
||||
let base_path = std::env::current_dir().expect("Failed to determine the current directory");
|
||||
let configuration_directory = base_path.join("configuration");
|
||||
|
||||
// Read the "default" configuration file
|
||||
settings.merge(config::File::from(configuration_directory.join("base")).required(true))?;
|
||||
|
||||
// Detect the running environment.
|
||||
// Default to `local` if unspecified.
|
||||
let environment: Environment = std::env::var("APP_ENVIRONMENT")
|
||||
.unwrap_or_else(|_| "local".into())
|
||||
.try_into()
|
||||
.expect("Failed to parse APP_ENVIRONMENT.");
|
||||
|
||||
// Layer on the environment-specific values.
|
||||
settings.merge(
|
||||
config::File::from(configuration_directory.join(environment.as_str())).required(true),
|
||||
)?;
|
||||
|
||||
let environment_filename = format!("{}.yaml", environment.as_str());
|
||||
let settings = config::Config::builder()
|
||||
.add_source(config::File::from(configuration_directory.join("base.yaml")))
|
||||
.add_source(config::File::from(configuration_directory.join(&environment_filename)))
|
||||
// Add in settings from environment variables (with a prefix of APP and '__' as separator)
|
||||
// E.g. `APP_APPLICATION__PORT=5001 would set `Settings.application.port`
|
||||
settings.merge(config::Environment::with_prefix("app").separator("__"))?;
|
||||
.add_source(config::Environment::with_prefix("APP").prefix_separator("_").separator("__"))
|
||||
.build()?;
|
||||
|
||||
settings.try_into()
|
||||
settings.try_deserialize::<Settings>()
|
||||
}
|
||||
|
||||
/// The possible runtime environment for our application.
|
||||
|
|
|
@ -60,7 +60,7 @@ impl Application {
|
|||
|
||||
pub fn get_connection_pool(configuration: &DatabaseSettings) -> PgPool {
|
||||
PgPoolOptions::new()
|
||||
.connect_timeout(std::time::Duration::from_secs(2))
|
||||
.acquire_timeout(std::time::Duration::from_secs(2))
|
||||
.connect_lazy_with(configuration.with_db())
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use fake::faker::name::en::Name;
|
|||
use fake::Fake;
|
||||
use std::time::Duration;
|
||||
use wiremock::matchers::{any, method, path};
|
||||
use wiremock::{Mock, MockBuilder, ResponseTemplate};
|
||||
use wiremock::{Mock, ResponseTemplate};
|
||||
|
||||
async fn create_unconfirmed_subscriber(app: &TestApp) -> ConfirmationLinks {
|
||||
// We are working with multiple subscribers now,
|
||||
|
|
Loading…
Reference in a new issue