Garage v0.8.3 #619

Merged
lx merged 8 commits from next-0.8 into main 2023-08-29 08:55:46 +00:00
23 changed files with 159 additions and 130 deletions

19
Cargo.lock generated
View file

@ -1198,7 +1198,7 @@ dependencies = [
[[package]]
name = "garage"
version = "0.8.2"
version = "0.8.3"
dependencies = [
"assert-json-diff",
"async-trait",
@ -1249,7 +1249,7 @@ dependencies = [
[[package]]
name = "garage_api"
version = "0.8.2"
version = "0.8.3"
dependencies = [
"async-trait",
"base64 0.21.3",
@ -1294,7 +1294,7 @@ dependencies = [
[[package]]
name = "garage_block"
version = "0.8.2"
version = "0.8.3"
dependencies = [
"arc-swap",
"async-compression",
@ -1319,7 +1319,7 @@ dependencies = [
[[package]]
name = "garage_db"
version = "0.8.2"
version = "0.8.3"
dependencies = [
"clap 4.4.0",
"err-derive",
@ -1334,7 +1334,7 @@ dependencies = [
[[package]]
name = "garage_model"
version = "0.8.2"
version = "0.8.3"
dependencies = [
"arc-swap",
"async-trait",
@ -1361,7 +1361,7 @@ dependencies = [
[[package]]
name = "garage_rpc"
version = "0.8.2"
version = "0.8.3"
dependencies = [
"arc-swap",
"async-trait",
@ -1369,6 +1369,7 @@ dependencies = [
"err-derive",
"futures",
"futures-util",
"garage_db",
"garage_util",
"gethostname",
"hex",
@ -1392,7 +1393,7 @@ dependencies = [
[[package]]
name = "garage_table"
version = "0.8.2"
version = "0.8.3"
dependencies = [
"arc-swap",
"async-trait",
@ -1414,7 +1415,7 @@ dependencies = [
[[package]]
name = "garage_util"
version = "0.8.2"
version = "0.8.3"
dependencies = [
"arc-swap",
"async-trait",
@ -1447,7 +1448,7 @@ dependencies = [
[[package]]
name = "garage_web"
version = "0.8.2"
version = "0.8.3"
dependencies = [
"err-derive",
"futures",

119
Cargo.nix
View file

@ -33,7 +33,7 @@ args@{
ignoreLockHash,
}:
let
nixifiedLockHash = "73f4922c1acb316874dad9027425e92d09716eb770774b39894496f9f87e39fe";
nixifiedLockHash = "a7a160a4ba7f9e704428eb860ae5c63eae57b2178e4a641d23a43ea1cef9e4a4";
workspaceSrc = if args.workspaceSrc == null then ./. else args.workspaceSrc;
currentLockHash = builtins.hashFile "sha256" (workspaceSrc + /Cargo.lock);
lockHashIgnored = if ignoreLockHash
@ -57,15 +57,15 @@ in
{
cargo2nixVersion = "0.11.0";
workspace = {
garage_db = rustPackages.unknown.garage_db."0.8.2";
garage_util = rustPackages.unknown.garage_util."0.8.2";
garage_rpc = rustPackages.unknown.garage_rpc."0.8.2";
garage_table = rustPackages.unknown.garage_table."0.8.2";
garage_block = rustPackages.unknown.garage_block."0.8.2";
garage_model = rustPackages.unknown.garage_model."0.8.2";
garage_api = rustPackages.unknown.garage_api."0.8.2";
garage_web = rustPackages.unknown.garage_web."0.8.2";
garage = rustPackages.unknown.garage."0.8.2";
garage_db = rustPackages.unknown.garage_db."0.8.3";
garage_util = rustPackages.unknown.garage_util."0.8.3";
garage_rpc = rustPackages.unknown.garage_rpc."0.8.3";
garage_table = rustPackages.unknown.garage_table."0.8.3";
garage_block = rustPackages.unknown.garage_block."0.8.3";
garage_model = rustPackages.unknown.garage_model."0.8.3";
garage_api = rustPackages.unknown.garage_api."0.8.3";
garage_web = rustPackages.unknown.garage_web."0.8.3";
garage = rustPackages.unknown.garage."0.8.3";
format_table = rustPackages.unknown.format_table."0.1.1";
k2v-client = rustPackages.unknown.k2v-client."0.0.4";
};
@ -1705,9 +1705,9 @@ in
};
});
"unknown".garage."0.8.2" = overridableMkRustCrate (profileName: rec {
"unknown".garage."0.8.3" = overridableMkRustCrate (profileName: rec {
name = "garage";
version = "0.8.2";
version = "0.8.3";
registry = "unknown";
src = fetchCrateLocal (workspaceSrc + "/src/garage");
features = builtins.concatLists [
@ -1734,14 +1734,14 @@ in
format_table = (rustPackages."unknown".format_table."0.1.1" { inherit profileName; }).out;
futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" { inherit profileName; }).out;
futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" { inherit profileName; }).out;
garage_api = (rustPackages."unknown".garage_api."0.8.2" { inherit profileName; }).out;
garage_block = (rustPackages."unknown".garage_block."0.8.2" { inherit profileName; }).out;
garage_db = (rustPackages."unknown".garage_db."0.8.2" { inherit profileName; }).out;
garage_model = (rustPackages."unknown".garage_model."0.8.2" { inherit profileName; }).out;
garage_rpc = (rustPackages."unknown".garage_rpc."0.8.2" { inherit profileName; }).out;
garage_table = (rustPackages."unknown".garage_table."0.8.2" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.2" { inherit profileName; }).out;
garage_web = (rustPackages."unknown".garage_web."0.8.2" { inherit profileName; }).out;
garage_api = (rustPackages."unknown".garage_api."0.8.3" { inherit profileName; }).out;
garage_block = (rustPackages."unknown".garage_block."0.8.3" { inherit profileName; }).out;
garage_db = (rustPackages."unknown".garage_db."0.8.3" { inherit profileName; }).out;
garage_model = (rustPackages."unknown".garage_model."0.8.3" { inherit profileName; }).out;
garage_rpc = (rustPackages."unknown".garage_rpc."0.8.3" { inherit profileName; }).out;
garage_table = (rustPackages."unknown".garage_table."0.8.3" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.3" { inherit profileName; }).out;
garage_web = (rustPackages."unknown".garage_web."0.8.3" { inherit profileName; }).out;
git_version = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".git-version."0.3.5" { inherit profileName; }).out;
hex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; }).out;
sodiumoxide = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".kuska-sodiumoxide."0.2.5-0" { inherit profileName; }).out;
@ -1777,9 +1777,9 @@ in
};
});
"unknown".garage_api."0.8.2" = overridableMkRustCrate (profileName: rec {
"unknown".garage_api."0.8.3" = overridableMkRustCrate (profileName: rec {
name = "garage_api";
version = "0.8.2";
version = "0.8.3";
registry = "unknown";
src = fetchCrateLocal (workspaceSrc + "/src/api");
features = builtins.concatLists [
@ -1798,11 +1798,11 @@ in
form_urlencoded = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".form_urlencoded."1.2.0" { inherit profileName; }).out;
futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" { inherit profileName; }).out;
futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" { inherit profileName; }).out;
garage_block = (rustPackages."unknown".garage_block."0.8.2" { inherit profileName; }).out;
garage_model = (rustPackages."unknown".garage_model."0.8.2" { inherit profileName; }).out;
garage_rpc = (rustPackages."unknown".garage_rpc."0.8.2" { inherit profileName; }).out;
garage_table = (rustPackages."unknown".garage_table."0.8.2" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.2" { inherit profileName; }).out;
garage_block = (rustPackages."unknown".garage_block."0.8.3" { inherit profileName; }).out;
garage_model = (rustPackages."unknown".garage_model."0.8.3" { inherit profileName; }).out;
garage_rpc = (rustPackages."unknown".garage_rpc."0.8.3" { inherit profileName; }).out;
garage_table = (rustPackages."unknown".garage_table."0.8.3" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.3" { inherit profileName; }).out;
hex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; }).out;
hmac = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hmac."0.12.1" { inherit profileName; }).out;
http = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.9" { inherit profileName; }).out;
@ -1831,9 +1831,9 @@ in
};
});
"unknown".garage_block."0.8.2" = overridableMkRustCrate (profileName: rec {
"unknown".garage_block."0.8.3" = overridableMkRustCrate (profileName: rec {
name = "garage_block";
version = "0.8.2";
version = "0.8.3";
registry = "unknown";
src = fetchCrateLocal (workspaceSrc + "/src/block");
features = builtins.concatLists [
@ -1846,10 +1846,10 @@ in
bytes = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.4.0" { inherit profileName; }).out;
futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" { inherit profileName; }).out;
futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" { inherit profileName; }).out;
garage_db = (rustPackages."unknown".garage_db."0.8.2" { inherit profileName; }).out;
garage_rpc = (rustPackages."unknown".garage_rpc."0.8.2" { inherit profileName; }).out;
garage_table = (rustPackages."unknown".garage_table."0.8.2" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.2" { inherit profileName; }).out;
garage_db = (rustPackages."unknown".garage_db."0.8.3" { inherit profileName; }).out;
garage_rpc = (rustPackages."unknown".garage_rpc."0.8.3" { inherit profileName; }).out;
garage_table = (rustPackages."unknown".garage_table."0.8.3" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.3" { inherit profileName; }).out;
hex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; }).out;
opentelemetry = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".opentelemetry."0.17.0" { inherit profileName; }).out;
rand = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; }).out;
@ -1862,9 +1862,9 @@ in
};
});
"unknown".garage_db."0.8.2" = overridableMkRustCrate (profileName: rec {
"unknown".garage_db."0.8.3" = overridableMkRustCrate (profileName: rec {
name = "garage_db";
version = "0.8.2";
version = "0.8.3";
registry = "unknown";
src = fetchCrateLocal (workspaceSrc + "/src/db");
features = builtins.concatLists [
@ -1894,9 +1894,9 @@ in
};
});
"unknown".garage_model."0.8.2" = overridableMkRustCrate (profileName: rec {
"unknown".garage_model."0.8.3" = overridableMkRustCrate (profileName: rec {
name = "garage_model";
version = "0.8.2";
version = "0.8.3";
registry = "unknown";
src = fetchCrateLocal (workspaceSrc + "/src/model");
features = builtins.concatLists [
@ -1914,11 +1914,11 @@ in
err_derive = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".err-derive."0.3.1" { profileName = "__noProfile"; }).out;
futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" { inherit profileName; }).out;
futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" { inherit profileName; }).out;
garage_block = (rustPackages."unknown".garage_block."0.8.2" { inherit profileName; }).out;
garage_db = (rustPackages."unknown".garage_db."0.8.2" { inherit profileName; }).out;
garage_rpc = (rustPackages."unknown".garage_rpc."0.8.2" { inherit profileName; }).out;
garage_table = (rustPackages."unknown".garage_table."0.8.2" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.2" { inherit profileName; }).out;
garage_block = (rustPackages."unknown".garage_block."0.8.3" { inherit profileName; }).out;
garage_db = (rustPackages."unknown".garage_db."0.8.3" { inherit profileName; }).out;
garage_rpc = (rustPackages."unknown".garage_rpc."0.8.3" { inherit profileName; }).out;
garage_table = (rustPackages."unknown".garage_table."0.8.3" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.3" { inherit profileName; }).out;
hex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; }).out;
netapp = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".netapp."0.5.3" { inherit profileName; }).out;
opentelemetry = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".opentelemetry."0.17.0" { inherit profileName; }).out;
@ -1931,9 +1931,9 @@ in
};
});
"unknown".garage_rpc."0.8.2" = overridableMkRustCrate (profileName: rec {
"unknown".garage_rpc."0.8.3" = overridableMkRustCrate (profileName: rec {
name = "garage_rpc";
version = "0.8.2";
version = "0.8.3";
registry = "unknown";
src = fetchCrateLocal (workspaceSrc + "/src/rpc");
features = builtins.concatLists [
@ -1953,7 +1953,8 @@ in
${ if rootFeatures' ? "garage/consul-discovery" || rootFeatures' ? "garage_rpc/consul-discovery" || rootFeatures' ? "garage_rpc/err-derive" then "err_derive" else null } = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".err-derive."0.3.1" { profileName = "__noProfile"; }).out;
futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" { inherit profileName; }).out;
futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.2" { inherit profileName; }).out;
garage_db = (rustPackages."unknown".garage_db."0.8.3" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.3" { inherit profileName; }).out;
gethostname = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".gethostname."0.4.3" { inherit profileName; }).out;
hex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; }).out;
${ if rootFeatures' ? "garage/kubernetes-discovery" || rootFeatures' ? "garage_rpc/k8s-openapi" || rootFeatures' ? "garage_rpc/kubernetes-discovery" then "k8s_openapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".k8s-openapi."0.16.0" { inherit profileName; }).out;
@ -1975,9 +1976,9 @@ in
};
});
"unknown".garage_table."0.8.2" = overridableMkRustCrate (profileName: rec {
"unknown".garage_table."0.8.3" = overridableMkRustCrate (profileName: rec {
name = "garage_table";
version = "0.8.2";
version = "0.8.3";
registry = "unknown";
src = fetchCrateLocal (workspaceSrc + "/src/table");
dependencies = {
@ -1986,9 +1987,9 @@ in
bytes = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.4.0" { inherit profileName; }).out;
futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" { inherit profileName; }).out;
futures_util = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.28" { inherit profileName; }).out;
garage_db = (rustPackages."unknown".garage_db."0.8.2" { inherit profileName; }).out;
garage_rpc = (rustPackages."unknown".garage_rpc."0.8.2" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.2" { inherit profileName; }).out;
garage_db = (rustPackages."unknown".garage_db."0.8.3" { inherit profileName; }).out;
garage_rpc = (rustPackages."unknown".garage_rpc."0.8.3" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.3" { inherit profileName; }).out;
hex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; }).out;
hexdump = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hexdump."0.1.1" { inherit profileName; }).out;
opentelemetry = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".opentelemetry."0.17.0" { inherit profileName; }).out;
@ -2000,9 +2001,9 @@ in
};
});
"unknown".garage_util."0.8.2" = overridableMkRustCrate (profileName: rec {
"unknown".garage_util."0.8.3" = overridableMkRustCrate (profileName: rec {
name = "garage_util";
version = "0.8.2";
version = "0.8.3";
registry = "unknown";
src = fetchCrateLocal (workspaceSrc + "/src/util");
features = builtins.concatLists [
@ -2017,7 +2018,7 @@ in
digest = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".digest."0.10.7" { inherit profileName; }).out;
err_derive = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".err-derive."0.3.1" { profileName = "__noProfile"; }).out;
futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" { inherit profileName; }).out;
garage_db = (rustPackages."unknown".garage_db."0.8.2" { inherit profileName; }).out;
garage_db = (rustPackages."unknown".garage_db."0.8.3" { inherit profileName; }).out;
hex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; }).out;
hexdump = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hexdump."0.1.1" { inherit profileName; }).out;
http = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.9" { inherit profileName; }).out;
@ -2043,18 +2044,18 @@ in
};
});
"unknown".garage_web."0.8.2" = overridableMkRustCrate (profileName: rec {
"unknown".garage_web."0.8.3" = overridableMkRustCrate (profileName: rec {
name = "garage_web";
version = "0.8.2";
version = "0.8.3";
registry = "unknown";
src = fetchCrateLocal (workspaceSrc + "/src/web");
dependencies = {
err_derive = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".err-derive."0.3.1" { profileName = "__noProfile"; }).out;
futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.28" { inherit profileName; }).out;
garage_api = (rustPackages."unknown".garage_api."0.8.2" { inherit profileName; }).out;
garage_model = (rustPackages."unknown".garage_model."0.8.2" { inherit profileName; }).out;
garage_table = (rustPackages."unknown".garage_table."0.8.2" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.2" { inherit profileName; }).out;
garage_api = (rustPackages."unknown".garage_api."0.8.3" { inherit profileName; }).out;
garage_model = (rustPackages."unknown".garage_model."0.8.3" { inherit profileName; }).out;
garage_table = (rustPackages."unknown".garage_table."0.8.3" { inherit profileName; }).out;
garage_util = (rustPackages."unknown".garage_util."0.8.3" { inherit profileName; }).out;
http = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.9" { inherit profileName; }).out;
hyper = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.27" { inherit profileName; }).out;
opentelemetry = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".opentelemetry."0.17.0" { inherit profileName; }).out;

View file

@ -18,14 +18,14 @@ default-members = ["src/garage"]
[workspace.dependencies]
format_table = { version = "0.1.1", path = "src/format-table" }
garage_api = { version = "0.8.2", path = "src/api" }
garage_block = { version = "0.8.2", path = "src/block" }
garage_db = { version = "0.8.2", path = "src/db", default-features = false }
garage_model = { version = "0.8.2", path = "src/model", default-features = false }
garage_rpc = { version = "0.8.2", path = "src/rpc" }
garage_table = { version = "0.8.2", path = "src/table" }
garage_util = { version = "0.8.2", path = "src/util" }
garage_web = { version = "0.8.2", path = "src/web" }
garage_api = { version = "0.8.3", path = "src/api" }
garage_block = { version = "0.8.3", path = "src/block" }
garage_db = { version = "0.8.3", path = "src/db", default-features = false }
garage_model = { version = "0.8.3", path = "src/model", default-features = false }
garage_rpc = { version = "0.8.3", path = "src/rpc" }
garage_table = { version = "0.8.3", path = "src/table" }
garage_util = { version = "0.8.3", path = "src/util" }
garage_web = { version = "0.8.3", path = "src/web" }
k2v-client = { version = "0.0.4", path = "src/k2v-client" }
[profile.dev]

View file

@ -7,10 +7,23 @@ Garage is also available in binary packages on:
## Alpine Linux
If you use Alpine Linux, you can simply install the
[garage](https://pkgs.alpinelinux.org/packages?name=garage) package from the
Alpine Linux repositories (available since v3.17):
```bash
apk install garage
apk add garage
```
The default configuration file is installed to `/etc/garage.toml`. You can run
Garage using: `rc-service garage start`. If you don't specify `rpc_secret`, it
will be automatically replaced with a random string on the first start.
Please note that this package is built without Consul discovery, Kubernetes
discovery, OpenTelemetry exporter, and K2V features (K2V will be enabled once
it's stable).
## Arch Linux
Garage is available in the [AUR](https://aur.archlinux.org/packages/garage).

View file

@ -35,6 +35,9 @@ Place this binary somewhere in your `$PATH` so that you can invoke the `garage`
command directly (for instance you can copy the binary in `/usr/local/bin`
or in `~/.local/bin`).
You may also check whether your distribution already includes a
[binary package for Garage](@/documentation/cookbook/binary-packages.md).
If a binary of the last version is not available for your architecture,
or if you want a build customized for your system,
you can [build Garage from source](@/documentation/cookbook/from-source.md).

View file

@ -21,4 +21,4 @@ version: 0.4.1
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v0.8.2"
appVersion: "v0.8.3"

View file

@ -1,6 +1,6 @@
[package]
name = "garage_api"
version = "0.8.2"
version = "0.8.3"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"

View file

@ -100,6 +100,20 @@ impl AdminApiServer {
.get("domain")
.ok_or_internal_error("Could not parse domain query string")?;
if self.check_domain(domain).await? {
Ok(Response::builder()
.status(StatusCode::OK)
.body(Body::from(format!(
"Domain '{domain}' is managed by Garage"
)))?)
} else {
Err(Error::bad_request(format!(
"Domain '{domain}' is not managed by Garage"
)))
}
}
async fn check_domain(&self, domain: &str) -> Result<bool, Error> {
// Resolve bucket from domain name, inferring if the website must be activated for the
// domain to be valid.
let (bucket_name, must_check_website) = if let Some(bname) = self
@ -123,19 +137,18 @@ impl AdminApiServer {
(domain.to_string(), true)
};
let bucket_id = self
let bucket_id = match self
.garage
.bucket_helper()
.resolve_global_bucket_name(&bucket_name)
.await?
.ok_or(HelperError::NoSuchBucket(bucket_name.to_string()))?;
{
Some(bucket_id) => bucket_id,
None => return Ok(false),
};
if !must_check_website {
return Ok(Response::builder()
.status(StatusCode::OK)
.body(Body::from(format!(
"Domain '{domain}' is managed by Garage"
)))?);
return Ok(true);
}
let bucket = self
@ -148,16 +161,8 @@ impl AdminApiServer {
let bucket_website_config = bucket_state.website_config.get();
match bucket_website_config {
Some(_v) => {
Ok(Response::builder()
.status(StatusCode::OK)
.body(Body::from(format!(
"Domain '{domain}' is managed by Garage"
)))?)
}
None => Err(Error::bad_request(format!(
"Domain '{domain}' is not managed by Garage"
))),
Some(_v) => Ok(true),
None => Ok(false),
}
}

View file

@ -1,6 +1,6 @@
[package]
name = "garage_block"
version = "0.8.2"
version = "0.8.3"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"

View file

@ -1,6 +1,6 @@
[package]
name = "garage_db"
version = "0.8.2"
version = "0.8.3"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"

View file

@ -1,6 +1,6 @@
[package]
name = "garage"
version = "0.8.2"
version = "0.8.3"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"

View file

@ -1,6 +1,7 @@
use aws_sdk_s3::config::Region;
use aws_sdk_s3::Client;
use ext::*;
#[cfg(feature = "k2v")]
use k2v_client::K2vClient;
#[macro_use]
@ -21,6 +22,7 @@ pub struct Context {
pub key: garage::Key,
pub client: Client,
pub custom_request: CustomRequester,
#[cfg(feature = "k2v")]
pub k2v: K2VContext,
}
@ -35,6 +37,7 @@ impl Context {
let key = garage.key(None);
let client = client::build_client(&key);
let custom_request = CustomRequester::new_s3(garage, &key);
#[cfg(feature = "k2v")]
let k2v_request = CustomRequester::new_k2v(garage, &key);
Context {
@ -42,6 +45,7 @@ impl Context {
client,
key,
custom_request,
#[cfg(feature = "k2v")]
k2v: K2VContext {
request: k2v_request,
},
@ -72,6 +76,7 @@ impl Context {
}
/// Build a K2vClient for a given bucket
#[cfg(feature = "k2v")]
pub fn k2v_client(&self, bucket: &str) -> K2vClient {
let config = k2v_client::K2vClientConfig {
region: REGION.to_string(),

View file

@ -6,7 +6,7 @@ use assert_json_diff::assert_json_eq;
use base64::prelude::*;
use serde_json::json;
use super::json_body;
use crate::json_body;
use hyper::{Method, StatusCode};
#[tokio::test]

View file

@ -6,7 +6,7 @@ use assert_json_diff::assert_json_eq;
use base64::prelude::*;
use serde_json::json;
use super::json_body;
use crate::json_body;
use hyper::{Method, StatusCode};
#[tokio::test]

View file

@ -3,16 +3,3 @@ pub mod errorcodes;
pub mod item;
pub mod poll;
pub mod simple;
use hyper::{Body, Response};
pub async fn json_body(res: Response<Body>) -> serde_json::Value {
let res_body: serde_json::Value = serde_json::from_slice(
&hyper::body::to_bytes(res.into_body())
.await
.unwrap()
.to_vec()[..],
)
.unwrap();
res_body
}

View file

@ -5,8 +5,8 @@ use std::time::Duration;
use assert_json_diff::assert_json_eq;
use serde_json::json;
use super::json_body;
use crate::common;
use crate::json_body;
#[tokio::test]
async fn test_poll_item() {

View file

@ -10,3 +10,16 @@ mod s3;
mod k2v;
#[cfg(feature = "k2v")]
mod k2v_client;
use hyper::{Body, Response};
pub async fn json_body(res: Response<Body>) -> serde_json::Value {
let res_body: serde_json::Value = serde_json::from_slice(
&hyper::body::to_bytes(res.into_body())
.await
.unwrap()
.to_vec()[..],
)
.unwrap();
res_body
}

View file

@ -1,6 +1,6 @@
use crate::common;
use crate::common::ext::*;
use crate::k2v::json_body;
use crate::json_body;
use assert_json_diff::assert_json_eq;
use aws_sdk_s3::{
@ -440,13 +440,13 @@ async fn test_website_check_domain() {
};
let admin_resp = client.request(admin_req()).await.unwrap();
assert_eq!(admin_resp.status(), StatusCode::NOT_FOUND);
assert_eq!(admin_resp.status(), StatusCode::BAD_REQUEST);
let res_body = json_body(admin_resp).await;
assert_json_eq!(
res_body,
json!({
"code": "NoSuchBucket",
"message": "Bucket not found: ",
"code": "InvalidRequest",
"message": "Bad request: Domain '' is not managed by Garage",
"region": "garage-integ-test",
"path": "/check",
})
@ -464,13 +464,13 @@ async fn test_website_check_domain() {
};
let admin_resp = client.request(admin_req()).await.unwrap();
assert_eq!(admin_resp.status(), StatusCode::NOT_FOUND);
assert_eq!(admin_resp.status(), StatusCode::BAD_REQUEST);
let res_body = json_body(admin_resp).await;
assert_json_eq!(
res_body,
json!({
"code": "NoSuchBucket",
"message": "Bucket not found: foobar",
"code": "InvalidRequest",
"message": "Bad request: Domain 'foobar' is not managed by Garage",
"region": "garage-integ-test",
"path": "/check",
})
@ -488,13 +488,13 @@ async fn test_website_check_domain() {
};
let admin_resp = client.request(admin_req()).await.unwrap();
assert_eq!(admin_resp.status(), StatusCode::NOT_FOUND);
assert_eq!(admin_resp.status(), StatusCode::BAD_REQUEST);
let res_body = json_body(admin_resp).await;
assert_json_eq!(
res_body,
json!({
"code": "NoSuchBucket",
"message": "Bucket not found: ☹",
"code": "InvalidRequest",
"message": "Bad request: Domain '☹' is not managed by Garage",
"region": "garage-integ-test",
"path": "/check",
})

View file

@ -1,6 +1,6 @@
[package]
name = "garage_model"
version = "0.8.2"
version = "0.8.3"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"

View file

@ -1,6 +1,6 @@
[package]
name = "garage_rpc"
version = "0.8.2"
version = "0.8.3"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"
@ -14,6 +14,7 @@ path = "lib.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
garage_db.workspace = true
garage_util.workspace = true
arc-swap = "1.0"

View file

@ -1,6 +1,6 @@
[package]
name = "garage_table"
version = "0.8.2"
version = "0.8.3"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"

View file

@ -1,6 +1,6 @@
[package]
name = "garage_util"
version = "0.8.2"
version = "0.8.3"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"

View file

@ -1,6 +1,6 @@
[package]
name = "garage_web"
version = "0.8.2"
version = "0.8.3"
authors = ["Alex Auvolat <alex@adnab.me>", "Quentin Dufour <quentin@dufour.io>"]
edition = "2018"
license = "AGPL-3.0"