This commit is contained in:
Luca Palmieri 2022-10-01 18:07:52 +01:00
parent 6895745cee
commit 485a8cc5fe
4 changed files with 64 additions and 59 deletions

View file

@ -30,7 +30,7 @@ jobs:
- 5432:5432
env:
SQLX_VERSION: 0.6.2
SQLX_FEATURES: postgres
SQLX_FEATURES: "rustls,postgres"
steps:
- name: Checkout repository
uses: actions/checkout@v2
@ -59,9 +59,8 @@ jobs:
path: |
~/.cargo/bin/sqlx
~/.cargo/bin/cargo-sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}-${{ env.SQLX_FEATURES }}
- name: Install sqlx-cli
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}
- name: Install sqlx-cli
uses: actions-rs/cargo@v1
if: steps.cache-sqlx.outputs.cache-hit == false
with:
@ -70,7 +69,7 @@ jobs:
sqlx-cli
--force
--version=${{ env.SQLX_VERSION }}
--features=${{ env.SQLX_FEATURES }}
--features ${{ env.SQLX_FEATURES }}
--no-default-features
--locked
@ -117,7 +116,7 @@ jobs:
- 5432:5432
env:
SQLX_VERSION: 0.6.2
SQLX_FEATURES: postgres
SQLX_FEATURES: "rustls,postgres"
steps:
- name: Checkout repository
uses: actions/checkout@v2
@ -135,7 +134,7 @@ jobs:
with:
path: |
~/.cargo/bin/sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}-${{ env.SQLX_FEATURES }}
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}
- name: Install sqlx-cli
uses: actions-rs/cargo@v1
@ -146,7 +145,7 @@ jobs:
sqlx-cli
--force
--version=${{ env.SQLX_VERSION }}
--features=${{ env.SQLX_FEATURES }}
--features ${{ env.SQLX_FEATURES }}
--no-default-features
--locked
@ -175,7 +174,7 @@ jobs:
- 5432:5432
env:
SQLX_VERSION: 0.6.2
SQLX_FEATURES: postgres
SQLX_FEATURES: "rustls,postgres"
steps:
- name: Checkout repository
uses: actions/checkout@v2
@ -192,7 +191,7 @@ jobs:
with:
path: |
~/.cargo/bin/sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}-${{ env.SQLX_FEATURES }}
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}
- name: Install sqlx-cli
uses: actions-rs/cargo@v1
@ -203,7 +202,7 @@ jobs:
sqlx-cli
--force
--version=${{ env.SQLX_VERSION }}
--features=${{ env.SQLX_FEATURES }}
--features ${{ env.SQLX_FEATURES }}
--no-default-features
--locked

84
Cargo.lock generated
View file

@ -165,7 +165,7 @@ dependencies = [
"serde_urlencoded",
"smallvec",
"socket2",
"time 0.3.14",
"time",
"url",
]
@ -242,9 +242,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.58"
version = "1.0.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704"
checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"
[[package]]
name = "assert-json-diff"
@ -258,9 +258,9 @@ dependencies = [
[[package]]
name = "async-channel"
version = "1.6.1"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319"
checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28"
dependencies = [
"concurrent-queue",
"event-listener",
@ -390,11 +390,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
dependencies = [
"iana-time-zone",
"js-sys",
"num-integer",
"num-traits",
"time 0.1.44",
"wasm-bindgen",
"winapi",
]
@ -409,9 +406,9 @@ dependencies = [
[[package]]
name = "concurrent-queue"
version = "1.2.2"
version = "1.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c"
dependencies = [
"cache-padded",
]
@ -443,7 +440,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "344adc371239ef32293cb1c4fe519592fcf21206c79c02854320afcdf3ab4917"
dependencies = [
"percent-encoding",
"time 0.3.14",
"time",
"version_check",
]
@ -691,9 +688,9 @@ dependencies = [
[[package]]
name = "futures"
version = "0.3.21"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e"
checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c"
dependencies = [
"futures-channel",
"futures-core",
@ -722,9 +719,9 @@ checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf"
[[package]]
name = "futures-executor"
version = "0.3.21"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6"
checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab"
dependencies = [
"futures-core",
"futures-task",
@ -744,9 +741,9 @@ dependencies = [
[[package]]
name = "futures-io"
version = "0.3.21"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b"
checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68"
[[package]]
name = "futures-lite"
@ -765,9 +762,9 @@ dependencies = [
[[package]]
name = "futures-macro"
version = "0.3.21"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512"
checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17"
dependencies = [
"proc-macro2",
"quote",
@ -1049,6 +1046,17 @@ dependencies = [
"winapi",
]
[[package]]
name = "idna"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
dependencies = [
"matches",
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "idna"
version = "0.3.0"
@ -1201,6 +1209,12 @@ dependencies = [
"regex-automata",
]
[[package]]
name = "matches"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "md-5"
version = "0.10.5"
@ -1544,7 +1558,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha 0.3.1",
"rand_core 0.6.3",
"rand_core 0.6.4",
]
[[package]]
@ -1564,7 +1578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core 0.6.3",
"rand_core 0.6.4",
]
[[package]]
@ -2128,17 +2142,6 @@ dependencies = [
"once_cell",
]
[[package]]
name = "time"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi",
]
[[package]]
name = "time"
version = "0.3.14"
@ -2301,7 +2304,7 @@ dependencies = [
"log",
"serde",
"serde_json",
"time 0.3.14",
"time",
"tracing",
"tracing-core",
"tracing-log",
@ -2405,7 +2408,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
dependencies = [
"form_urlencoded",
"idna",
"idna 0.3.0",
"percent-encoding",
"serde",
]
@ -2425,7 +2428,7 @@ version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f07b0a1390e01c0fc35ebb26b28ced33c9a3808f7f9fbe94d3cc01e233bfeed5"
dependencies = [
"idna",
"idna 0.2.3",
"lazy_static",
"regex",
"serde",
@ -2474,12 +2477,6 @@ version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@ -2668,12 +2665,13 @@ dependencies = [
[[package]]
name = "wiremock"
version = "0.5.13"
version = "0.5.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b12f508bdca434a55d43614d26f02e6b3e98ebeecfbc5a1614e0a0c8bf3e315"
checksum = "cc3c7b7557dbfdad6431b5a51196c9110cef9d83f6a9b26699f35cdc0ae113ec"
dependencies = [
"assert-json-diff",
"async-trait",
"base64",
"deadpool",
"futures",
"futures-timer",

View file

@ -19,7 +19,7 @@ serde = "1.0.115"
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"] }
chrono = "0.4.15"
chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] }
log = "0.4"
tracing = "0.1.19"

View file

@ -83,13 +83,21 @@ pub fn get_configuration() -> Result<Settings, config::ConfigError> {
.expect("Failed to parse APP_ENVIRONMENT.");
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_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`
.add_source(config::Environment::with_prefix("APP").prefix_separator("_").separator("__"))
.add_source(
config::Environment::with_prefix("APP")
.prefix_separator("_")
.separator("__"),
)
.build()?;
settings.try_deserialize::<Settings>()
}