This commit is contained in:
Luca Palmieri 2022-10-01 18:07:52 +01:00
parent 285653b802
commit f28b89ee94
4 changed files with 26 additions and 39 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

26
Cargo.lock generated
View file

@ -165,7 +165,7 @@ dependencies = [
"serde_urlencoded",
"smallvec",
"socket2",
"time 0.3.14",
"time",
"url",
]
@ -416,11 +416,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",
]
@ -469,7 +466,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "344adc371239ef32293cb1c4fe519592fcf21206c79c02854320afcdf3ab4917"
dependencies = [
"percent-encoding",
"time 0.3.14",
"time",
"version_check",
]
@ -2016,17 +2013,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"
@ -2179,7 +2165,7 @@ dependencies = [
"log",
"serde",
"serde_json",
"time 0.3.14",
"time",
"tracing",
"tracing-core",
"tracing-log",
@ -2346,12 +2332,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"

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

@ -84,13 +84,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>()
}