Add Blossom blob storage server and subscription management
- Introduced the `initializeBlossomServer` function to set up the Blossom blob storage server with dynamic base URL handling and ACL configuration. - Implemented the `blossomHandler` method to manage incoming requests to the Blossom API, ensuring proper URL handling and context management. - Enhanced the `PaymentProcessor` to support Blossom service levels, allowing for subscription extensions based on payment metadata. - Added methods for parsing and validating Blossom service levels, including storage quota management and subscription extension logic. - Updated the configuration to include Blossom service level settings, facilitating dynamic service level management. - Integrated storage quota checks in the blob upload process to prevent exceeding allocated limits. - Refactored existing code to improve organization and maintainability, including the removal of unused blob directory configurations. - Added tests to ensure the robustness of new functionalities and maintain existing behavior across blob operations.
This commit is contained in:
@@ -39,19 +39,12 @@ func testSetup(t *testing.T) (*Server, func()) {
|
||||
// Create ACL registry
|
||||
aclRegistry := acl.Registry
|
||||
|
||||
// Create temporary directory for blob storage
|
||||
blobDir, err := os.MkdirTemp("", "blossom-blobs-*")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create blob temp dir: %v", err)
|
||||
}
|
||||
|
||||
// Create server
|
||||
cfg := &Config{
|
||||
BaseURL: "http://localhost:8080",
|
||||
MaxBlobSize: 100 * 1024 * 1024, // 100MB
|
||||
AllowedMimeTypes: nil,
|
||||
RequireAuth: false,
|
||||
BlobDir: blobDir,
|
||||
}
|
||||
|
||||
server := NewServer(db, aclRegistry, cfg)
|
||||
@@ -60,7 +53,6 @@ func testSetup(t *testing.T) (*Server, func()) {
|
||||
cancel()
|
||||
db.Close()
|
||||
os.RemoveAll(tempDir)
|
||||
os.RemoveAll(blobDir)
|
||||
}
|
||||
|
||||
return server, cleanup
|
||||
|
||||
Reference in New Issue
Block a user