forked from matteo/serves3
1
0
Fork 0

chore: update dependencies to latest versions

This commit is contained in:
Matteo Settenvini 2024-09-28 03:08:08 +02:00
parent e3aca4fe72
commit 373b141346
7 changed files with 761 additions and 932 deletions

View File

@ -3,7 +3,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-yaml
name: Check YAML files syntax
@ -40,7 +40,7 @@ repos:
name: Check Rust code
- repo: https://github.com/fsfe/reuse-tool.git
rev: v3.0.2
rev: v4.0.3
hooks:
- id: reuse
name: Check copyright and license information

1602
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
[package]
name = "serves3"
version = "1.1.0"
version = "1.1.1"
authors = ["Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>"]
description = "A very simple proxy to browse files from private S3 buckets"
@ -26,20 +26,21 @@ lazy_static = "1.4"
log = "0.4"
rocket = "0.5"
rocket_dyn_templates = { version = "0.2.0", features = ["tera"] }
rust-s3 = { version = "0.33", default-features = false, features = [
"tokio-native-tls",
rust-s3 = { version = "0.35", default-features = false, features = [
"tokio-rustls-tls",
] }
serde = { version = "1.0" }
tempfile = { version = "3.6" }
serde = "1.0"
tempfile = "3.6"
[dev-dependencies]
libc = "0.2"
delegate = "0.13"
futures = "0.3"
libc = "0.2"
regex = "1.10"
rstest = "0.21"
reqwest = "0.12"
scraper = "0.19"
rstest = "0.22"
scraper = "0.20"
test-log = "0.2"
testcontainers = "0.17"
testcontainers-modules = { version = "0.5", features = ["minio"] }
testcontainers = "0.23"
testcontainers-modules = { version = "0.11", features = ["minio"] }
tokio = { version = "1", features = ["process"] }

View File

@ -64,10 +64,11 @@ allow = [
"Apache-2.0",
"BSD-3-Clause",
"CC0-1.0",
"EUPL-1.2",
"ISC",
"MIT",
"OpenSSL",
"MPL-2.0",
"Unicode-3.0",
"Unicode-DFS-2016",
]
# The confidence threshold for detecting a license from license text.

View File

@ -7,10 +7,10 @@ use {anyhow::anyhow, rocket::serde::Deserialize, serde::de::Error};
#[serde(crate = "rocket::serde")]
pub struct Settings {
#[serde(deserialize_with = "deserialize_s3_bucket")]
pub s3_bucket: s3::Bucket,
pub s3_bucket: Box<s3::Bucket>,
}
fn deserialize_s3_bucket<'de, D>(deserializer: D) -> Result<s3::Bucket, D::Error>
fn deserialize_s3_bucket<'de, D>(deserializer: D) -> Result<Box<s3::Bucket>, D::Error>
where
D: serde::Deserializer<'de>,
{
@ -31,10 +31,10 @@ pub struct S3Config {
pub secret_access_key: String,
}
impl TryInto<s3::Bucket> for S3Config {
impl TryInto<Box<s3::Bucket>> for S3Config {
type Error = anyhow::Error;
fn try_into(self) -> Result<s3::Bucket, Self::Error> {
fn try_into(self) -> Result<Box<s3::Bucket>, Self::Error> {
let region = s3::Region::Custom {
region: self.region,
endpoint: self.endpoint,

View File

@ -1,31 +1,47 @@
// SPDX-FileCopyrightText: © Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>
// SPDX-License-Identifier: EUPL-1.2
use {testcontainers::core::WaitFor, testcontainers::Image, testcontainers_modules::minio};
use {
delegate::delegate,
std::borrow::Cow,
testcontainers::{
core::{ContainerPort, WaitFor},
Image,
},
testcontainers_modules::minio,
};
const MINIO_IMAGE_TAG: &'static str = "RELEASE.2024-05-28T17-19-04Z";
const MINIO_IMAGE_TAG: &'static str = "RELEASE.2024-09-22T00-33-43Z";
pub struct MinIO {
inner: minio::MinIO,
}
impl Image for MinIO {
type Args = minio::MinIOServerArgs;
fn name(&self) -> String {
self.inner.name()
fn tag(&self) -> &str {
MINIO_IMAGE_TAG.into()
}
fn ready_conditions(&self) -> Vec<WaitFor> {
vec![WaitFor::message_on_stderr("API:")]
}
fn tag(&self) -> String {
MINIO_IMAGE_TAG.into()
delegate! {
to self.inner {
fn name(&self) -> &str;
fn expose_ports(&self) -> &[ContainerPort];
fn env_vars(
&self,
) -> impl IntoIterator<Item = (impl Into<Cow<'_, str>>, impl Into<Cow<'_, str>>)>;
fn mounts(&self) -> impl IntoIterator<Item = &testcontainers::core::Mount>;
fn copy_to_sources(&self) -> impl IntoIterator<Item = &testcontainers::CopyToContainer>;
fn entrypoint(&self) -> Option<&str>;
fn cmd(&self) -> impl IntoIterator<Item = impl Into<std::borrow::Cow<'_, str>>>;
fn exec_after_start(
&self,
cs: testcontainers::core::ContainerState,
) -> Result<Vec<testcontainers::core::ExecCommand>, testcontainers::TestcontainersError>;
}
fn env_vars(&self) -> Box<dyn Iterator<Item = (&String, &String)> + '_> {
self.inner.env_vars()
}
}

View File

@ -13,9 +13,9 @@ use {
pub struct Test {
pub base_url: Url,
pub bucket: s3::Bucket,
pub bucket: Box<s3::Bucket>,
pub serves3: tokio::process::Child,
pub minio: ContainerAsync<minio::MinIO>,
pub _minio: ContainerAsync<minio::MinIO>,
}
const MAXIMUM_SERVES3_INIT_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(5);
@ -27,11 +27,10 @@ const SECRET_KEY: &'static str = "minioadmin";
impl Test {
pub async fn new() -> Result<Self> {
// NOTE: right now there is a bug in bollard
// that makes testcontainers work in Docker only and
// not podman (it is not able to fetch exposed ports).
// If this test fails make sure you are using docker.
std::env::remove_var("DOCKER_HOST");
// NOTE: this testsuite was setup to work
// against a recent version of podman,
// which correctly distinguishes between
// stdout and stderr of the running container.
let image = minio::MinIO::default();
let container = image.start().await?;
@ -107,7 +106,7 @@ impl Test {
base_url,
bucket,
serves3: child,
minio: container,
_minio: container,
})
}
}