mirror of
https://github.com/getnora-io/nora.git
synced 2026-04-12 20:50:31 +00:00
feat: configurable body limit + Docker delete API
- Add body_limit_mb to ServerConfig (default 2048MB, env NORA_BODY_LIMIT_MB)
- Replace hardcoded 100MB DefaultBodyLimit with config value
- Add DELETE /v2/{name}/manifests/{reference} endpoint (Docker Registry V2 spec)
- Add DELETE /v2/{name}/blobs/{digest} endpoint
- Add namespace-qualified variants for both DELETE endpoints
- Return 202 Accepted on success, 404 with MANIFEST_UNKNOWN/BLOB_UNKNOWN errors
- Audit log integration for delete operations
Fixes: 413 Payload Too Large on Docker push >100MB
This commit is contained in:
@@ -36,6 +36,13 @@ pub struct ServerConfig {
|
||||
/// Public URL for generating pull commands (e.g., "registry.example.com")
|
||||
#[serde(default)]
|
||||
pub public_url: Option<String>,
|
||||
/// Maximum request body size in MB (default: 2048 = 2GB)
|
||||
#[serde(default = "default_body_limit_mb")]
|
||||
pub body_limit_mb: usize,
|
||||
}
|
||||
|
||||
fn default_body_limit_mb() -> usize {
|
||||
2048 // 2GB - enough for any Docker image
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
|
||||
@@ -330,6 +337,11 @@ impl Config {
|
||||
if let Ok(val) = env::var("NORA_PUBLIC_URL") {
|
||||
self.server.public_url = if val.is_empty() { None } else { Some(val) };
|
||||
}
|
||||
if let Ok(val) = env::var("NORA_BODY_LIMIT_MB") {
|
||||
if let Ok(mb) = val.parse() {
|
||||
self.server.body_limit_mb = mb;
|
||||
}
|
||||
}
|
||||
|
||||
// Storage config
|
||||
if let Ok(val) = env::var("NORA_STORAGE_MODE") {
|
||||
@@ -483,6 +495,7 @@ impl Default for Config {
|
||||
host: String::from("127.0.0.1"),
|
||||
port: 4000,
|
||||
public_url: None,
|
||||
body_limit_mb: 2048,
|
||||
},
|
||||
storage: StorageConfig {
|
||||
mode: StorageMode::Local,
|
||||
|
||||
Reference in New Issue
Block a user