mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-12-02 22:26:31 +00:00
Upgrade uuid, sqlx and config
This commit is contained in:
parent
f2103c2720
commit
e82f0c656c
4 changed files with 383 additions and 423 deletions
787
Cargo.lock
generated
787
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -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"] }
|
||||
uuid = { version = "0.8.1", features = ["v4"] }
|
||||
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"] }
|
||||
uuid = { version = "1", features = ["v4"] }
|
||||
chrono = "0.4.15"
|
||||
tracing = "0.1.19"
|
||||
tracing-subscriber = { version = "0.3", features = ["registry", "env-filter"] }
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -39,9 +39,8 @@ impl DatabaseSettings {
|
|||
}
|
||||
|
||||
pub fn get_configuration() -> Result<Settings, config::ConfigError> {
|
||||
let mut settings = config::Config::default();
|
||||
|
||||
settings.merge(config::File::with_name("configuration"))?;
|
||||
|
||||
settings.try_into()
|
||||
let settings = config::Config::builder()
|
||||
.add_source(config::File::new("configuration.yaml", config::FileFormat::Yaml))
|
||||
.build()?;
|
||||
settings.try_deserialize::<Settings>()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue