mirror of
https://github.com/azaion/admin.git
synced 2026-06-21 06:51:08 +00:00
c7b297de83
- Deleted the deploy.cmd script as it was no longer needed. - Updated Dockerfile to include curl for health checks and added a non-root user for improved security. - Modified health check command to use curl for better reliability. - Adjusted docker-compose.test.yml to reflect changes in health check configuration. - Cleaned up appsettings.json and removed unused configuration properties. - Removed Resource entity and related requests from the codebase as part of the architectural shift. - Updated documentation to reflect the removal of hardware binding and related endpoints. Co-authored-by: Cursor <cursoragent@cursor.com>
2.8 KiB
2.8 KiB
Module: Azaion.Services.ResourcesService
Purpose
File-based resource management: upload, list, download (encrypted), clear, and installer retrieval from the server's filesystem.
Public Interface
IResourcesService
| Method | Signature | Description |
|---|---|---|
GetInstaller |
(string?, Stream?) GetInstaller(bool isStage) |
Returns the latest installer file (prod or stage) |
GetEncryptedResource |
Task<Stream> GetEncryptedResource(string? dataFolder, string fileName, string key, CancellationToken ct) |
Reads a file and returns it AES-encrypted |
SaveResource |
Task SaveResource(string? dataFolder, IFormFile data, CancellationToken ct) |
Saves an uploaded file to the resource folder |
ListResources |
Task<IEnumerable<string>> ListResources(string? dataFolder, string? search, CancellationToken ct) |
Lists file names in a resource folder, optionally filtered |
ClearFolder |
void ClearFolder(string? dataFolder) |
Deletes all files and subdirectories in the specified folder |
Internal Logic
- GetResourceFolder: resolves the target directory. If
dataFolderis null/empty, usesResourcesConfig.ResourcesFolderdirectly; otherwise, appends it as a subdirectory. - GetInstaller: scans the installer folder for files matching
"AzaionSuite.Iterative*", returns the first match as aFileStream. - GetEncryptedResource: opens the file, encrypts via
Security.EncryptToextension into aMemoryStream, returns the encrypted stream. - SaveResource: creates the folder if needed, deletes any existing file with the same name, then copies the uploaded file.
- ListResources: uses
DirectoryInfo.GetFileswith optional search pattern. - ClearFolder: iterates and deletes all files and subdirectories.
Dependencies
IOptions<ResourcesConfig>— folder pathsILogger<ResourcesService>— logs successful savesBusinessException— thrown for null file uploadsSecurity.EncryptTo— stream encryption extension
Consumers
Program.cs— all/resources/*endpoints
Data Models
None.
Configuration
Uses ResourcesConfig (ResourcesFolder, SuiteInstallerFolder, SuiteStageInstallerFolder).
External Integrations
Local filesystem for resource storage.
Security
- Resources are encrypted per-user using a key derived from
email + password(the hardware-hash component was removed by AZ-197 — seeservices_security.md). - File deletion overwrites existing files before writing new ones.
- No path traversal protection on
dataFolderparameter.
Tests
None at the module level. End-to-end coverage lives in e2e/Azaion.E2E/Tests/ResourceTests.cs (encrypted download / round-trip / 200 MB upload limit) — updated by AZ-197 to stop sending the Hardware field.