2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 11:21:24 +00:00

Release candidate 1

This commit is contained in:
Aode (Lion) 2022-02-26 12:22:30 -06:00
parent b0a6f124a6
commit 73137ede21
5 changed files with 313 additions and 255 deletions

View file

@ -1,2 +1,2 @@
[build] [build]
# rustflags = ["--cfg", "tokio_unstable"] rustflags = ["--cfg", "tokio_unstable"]

519
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
[package] [package]
name = "pict-rs" name = "pict-rs"
description = "A simple image hosting service" description = "A simple image hosting service"
version = "0.3.0-beta.20" version = "0.3.0-rc.1"
authors = ["asonix <asonix@asonix.dog>"] authors = ["asonix <asonix@asonix.dog>"]
license = "AGPL-3.0" license = "AGPL-3.0"
readme = "README.md" readme = "README.md"
@ -11,7 +11,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features] [features]
console = ["console-subscriber"] console = ["console-subscriber"]
default = ["object-storage"] default = ["object-storage", "console"]
object-storage = ["reqwest", "rust-s3"] object-storage = ["reqwest", "rust-s3"]
io-uring = [ io-uring = [
"actix-rt/io-uring", "actix-rt/io-uring",
@ -24,14 +24,14 @@ io-uring = [
actix-form-data = "0.6.0-beta.11" actix-form-data = "0.6.0-beta.11"
actix-rt = { version = "2.6.0", default-features = false } actix-rt = { version = "2.6.0", default-features = false }
actix-server = "2.0.0" actix-server = "2.0.0"
actix-web = { version = "4.0.0-rc.3", default-features = false } actix-web = { version = "4.0.0", default-features = false }
anyhow = "1.0" anyhow = "1.0"
async-trait = "0.1.51" async-trait = "0.1.51"
awc = { version = "3.0.0-beta.20", default-features = false, features = [ awc = { version = "3.0.0-beta.21", default-features = false, features = [
"rustls", "rustls",
] } ] }
base64 = "0.13.0" base64 = "0.13.0"
config = "0.11.0" config = "0.12.0"
console-subscriber = { version = "0.1", optional = true } console-subscriber = { version = "0.1", optional = true }
dashmap = "5.1.0" dashmap = "5.1.0"
futures-util = "0.3.17" futures-util = "0.3.17"
@ -45,7 +45,7 @@ reqwest = { version = "0.11.5", default-features = false, features = [
"rustls-tls", "rustls-tls",
"stream", "stream",
], optional = true } ], optional = true }
rust-s3 = { version = "0.28.0", default-features = false, features = [ rust-s3 = { version = "0.29.0", default-features = false, features = [
"fail-on-err", "fail-on-err",
"with-reqwest", "with-reqwest",
], optional = true, git = "https://github.com/asonix/rust-s3", branch = "asonix/generic-client" } ], optional = true, git = "https://github.com/asonix/rust-s3", branch = "asonix/generic-client" }
@ -74,11 +74,11 @@ url = { version = "2.2", features = ["serde"] }
uuid = { version = "0.8.2", features = ["v4", "serde"] } uuid = { version = "0.8.2", features = ["v4", "serde"] }
[dependencies.tracing-actix-web] [dependencies.tracing-actix-web]
version = "0.5.0-rc.3" version = "0.5.0"
default-features = false default-features = false
features = ["emit_event_on_error", "opentelemetry_0_17"] features = ["emit_event_on_error", "opentelemetry_0_17"]
[dependencies.tracing-awc] [dependencies.tracing-awc]
version = "0.1.0-beta.23" version = "0.1.0-beta.24"
default-features = false default-features = false
features = ["emit_event_on_error", "opentelemetry_0_17"] features = ["emit_event_on_error", "opentelemetry_0_17"]

View file

@ -9,7 +9,7 @@ _a simple image hosting service_
## Usage ## Usage
### Running ### Running
``` ```
pict-rs 0.3.0-alpha.43 pict-rs 0.3.0-rc.1
USAGE: USAGE:
pict-rs [FLAGS] [OPTIONS] [SUBCOMMAND] pict-rs [FLAGS] [OPTIONS] [SUBCOMMAND]
@ -46,7 +46,7 @@ SUBCOMMANDS:
``` ```
``` ```
pict-rs-file-store 0.3.0-alpha.43 pict-rs-file-store 0.3.0-rc.1
USAGE: USAGE:
pict-rs file-store [OPTIONS] pict-rs file-store [OPTIONS]
@ -60,7 +60,7 @@ OPTIONS:
``` ```
``` ```
pict-rs-s3-store 0.3.0-alpha.43 pict-rs-s3-store 0.3.0-rc.1
USAGE: USAGE:
pict-rs s3-store [OPTIONS] --bucket-name <bucket-name> --region <region> pict-rs s3-store [OPTIONS] --bucket-name <bucket-name> --region <region>
@ -75,7 +75,7 @@ OPTIONS:
--region <region> Region in which the bucket exists, can be an http endpoint --region <region> Region in which the bucket exists, can be an http endpoint
--secret-key <secret-key> --secret-key <secret-key>
--security-token <security-token> --security-token <security-token>
--session-token <session-token> --session-token <session-token>
``` ```
See [`pict-rs.toml`](https://git.asonix.dog/asonix/pict-rs/src/branch/main/pict-rs.toml) and See [`pict-rs.toml`](https://git.asonix.dog/asonix/pict-rs/src/branch/main/pict-rs.toml) and

View file

@ -217,30 +217,33 @@ impl Defaults {
impl Config { impl Config {
pub(crate) fn build() -> anyhow::Result<Self> { pub(crate) fn build() -> anyhow::Result<Self> {
let args = Args::from_args(); let args = Args::from_args();
let mut base_config = config::Config::new();
base_config.merge(config::Config::try_from(&Defaults::new())?)?;
if let Some(path) = args.migrate_file { if let Some(path) = args.migrate_file {
let mut migrate_config = config::Config::new(); let migrate_config = config::Config::builder()
migrate_config.merge(config::File::from(path))?; .add_source(config::File::from(path))
let migrate: Migrate = migrate_config.try_into()?; .build()?;
let migrate: Migrate = migrate_config.try_deserialize()?;
crate::MIGRATE.set(migrate).unwrap(); crate::MIGRATE.set(migrate).unwrap();
} }
let mut base_config =
config::Config::builder().add_source(config::Config::try_from(&Defaults::new())?);
if let Some(path) = args.config_file { if let Some(path) = args.config_file {
base_config.merge(config::File::from(path))?; base_config = base_config.add_source(config::File::from(path));
}; };
if !args.overrides.is_default() { if !args.overrides.is_default() {
let merging = config::Config::try_from(&args.overrides)?; let merging = config::Config::try_from(&args.overrides)?;
base_config.merge(merging)?; base_config = base_config.add_source(merging);
} }
base_config.merge(config::Environment::with_prefix("PICTRS").separator("__"))?; let config: Self = base_config
.add_source(config::Environment::with_prefix("PICTRS").separator("__"))
let config: Self = base_config.try_into()?; .build()?
.try_deserialize()?;
Ok(config) Ok(config)
} }