This commit is contained in:
Luca Palmieri 2022-10-01 18:07:52 +01:00
parent e0c6f8ddf0
commit 7cdcdb8e0d
4 changed files with 29 additions and 42 deletions

View file

@ -34,7 +34,7 @@ jobs:
- 6379:6379 - 6379:6379
env: env:
SQLX_VERSION: 0.6.2 SQLX_VERSION: 0.6.2
SQLX_FEATURES: postgres SQLX_FEATURES: "rustls,postgres"
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -63,9 +63,8 @@ jobs:
path: | path: |
~/.cargo/bin/sqlx ~/.cargo/bin/sqlx
~/.cargo/bin/cargo-sqlx ~/.cargo/bin/cargo-sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}-${{ env.SQLX_FEATURES }} key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}
- name: Install sqlx-cli
- name: Install sqlx-cli
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
if: steps.cache-sqlx.outputs.cache-hit == false if: steps.cache-sqlx.outputs.cache-hit == false
with: with:
@ -74,7 +73,7 @@ jobs:
sqlx-cli sqlx-cli
--force --force
--version=${{ env.SQLX_VERSION }} --version=${{ env.SQLX_VERSION }}
--features=${{ env.SQLX_FEATURES }} --features ${{ env.SQLX_FEATURES }}
--no-default-features --no-default-features
--locked --locked
@ -121,7 +120,7 @@ jobs:
- 5432:5432 - 5432:5432
env: env:
SQLX_VERSION: 0.6.2 SQLX_VERSION: 0.6.2
SQLX_FEATURES: postgres SQLX_FEATURES: "rustls,postgres"
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -139,7 +138,7 @@ jobs:
with: with:
path: | path: |
~/.cargo/bin/sqlx ~/.cargo/bin/sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}-${{ env.SQLX_FEATURES }} key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}
- name: Install sqlx-cli - name: Install sqlx-cli
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
@ -150,7 +149,7 @@ jobs:
sqlx-cli sqlx-cli
--force --force
--version=${{ env.SQLX_VERSION }} --version=${{ env.SQLX_VERSION }}
--features=${{ env.SQLX_FEATURES }} --features ${{ env.SQLX_FEATURES }}
--no-default-features --no-default-features
--locked --locked
@ -183,7 +182,7 @@ jobs:
- 6379:6379 - 6379:6379
env: env:
SQLX_VERSION: 0.6.2 SQLX_VERSION: 0.6.2
SQLX_FEATURES: postgres SQLX_FEATURES: "rustls,postgres"
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -200,7 +199,7 @@ jobs:
with: with:
path: | path: |
~/.cargo/bin/sqlx ~/.cargo/bin/sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}-${{ env.SQLX_FEATURES }} key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}
- name: Install sqlx-cli - name: Install sqlx-cli
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
@ -211,7 +210,7 @@ jobs:
sqlx-cli sqlx-cli
--force --force
--version=${{ env.SQLX_VERSION }} --version=${{ env.SQLX_VERSION }}
--features=${{ env.SQLX_FEATURES }} --features ${{ env.SQLX_FEATURES }}
--no-default-features --no-default-features
--locked --locked

32
Cargo.lock generated
View file

@ -157,7 +157,7 @@ dependencies = [
"redis", "redis",
"serde", "serde",
"serde_json", "serde_json",
"time 0.3.14", "time",
"tracing", "tracing",
] ]
@ -208,7 +208,7 @@ dependencies = [
"serde_urlencoded", "serde_urlencoded",
"smallvec", "smallvec",
"socket2", "socket2",
"time 0.3.14", "time",
"url", "url",
] ]
@ -236,7 +236,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror",
"time 0.3.14", "time",
"tokio", "tokio",
] ]
@ -584,11 +584,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
dependencies = [ dependencies = [
"iana-time-zone", "iana-time-zone",
"js-sys",
"num-integer", "num-integer",
"num-traits", "num-traits",
"time 0.1.44",
"wasm-bindgen",
"winapi", "winapi",
] ]
@ -668,7 +665,7 @@ dependencies = [
"rand 0.8.5", "rand 0.8.5",
"sha2", "sha2",
"subtle", "subtle",
"time 0.3.14", "time",
"version_check", "version_check",
] ]
@ -684,7 +681,7 @@ dependencies = [
"publicsuffix", "publicsuffix",
"serde", "serde",
"serde_json", "serde_json",
"time 0.3.14", "time",
"url", "url",
] ]
@ -2533,17 +2530,6 @@ dependencies = [
"once_cell", "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]] [[package]]
name = "time" name = "time"
version = "0.3.14" version = "0.3.14"
@ -2706,7 +2692,7 @@ dependencies = [
"log", "log",
"serde", "serde",
"serde_json", "serde_json",
"time 0.3.14", "time",
"tracing", "tracing",
"tracing-core", "tracing-core",
"tracing-log", "tracing-log",
@ -2899,12 +2885,6 @@ version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 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]] [[package]]
name = "wasi" name = "wasi"
version = "0.11.0+wasi-snapshot-preview1" 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"] } 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"] } sqlx = { version = "0.6", default-features = false, features = ["runtime-actix-rustls", "macros", "postgres", "uuid", "chrono", "migrate", "offline"] }
uuid = { version = "1", features = ["v4", "serde"] } uuid = { version = "1", features = ["v4", "serde"] }
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", "cookies"] } reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls", "cookies"] }
log = "0.4" log = "0.4"
tracing = "0.1.19" tracing = "0.1.19"

View file

@ -98,13 +98,21 @@ pub fn get_configuration() -> Result<Settings, config::ConfigError> {
.expect("Failed to parse APP_ENVIRONMENT."); .expect("Failed to parse APP_ENVIRONMENT.");
let environment_filename = format!("{}.yaml", environment.as_str()); let environment_filename = format!("{}.yaml", environment.as_str());
let settings = config::Config::builder() let settings = config::Config::builder()
.add_source(config::File::from(configuration_directory.join("base.yaml"))) .add_source(config::File::from(
.add_source(config::File::from(configuration_directory.join(&environment_filename))) 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) // 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` // 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()?; .build()?;
settings.try_deserialize::<Settings>() settings.try_deserialize::<Settings>()
} }