feat(core): rebrand to @lossless.zone/objectstorage
- Rename from @lossless.zone/s3container to @lossless.zone/objectstorage - Replace @push.rocks/smarts3 with @push.rocks/smartstorage - Change env var prefix from S3_ to OBJST_ - Rename S3Container class to ObjectStorageContainer - Update web component prefix from s3c- to objst- - Update UI labels, CLI flags, documentation, and Docker config
This commit is contained in:
63
ts/opsserver/classes.opsserver.ts
Normal file
63
ts/opsserver/classes.opsserver.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import * as plugins from '../plugins.ts';
|
||||
import type { ObjectStorageContainer } from '../classes/objectstoragecontainer.ts';
|
||||
import * as handlers from './handlers/index.ts';
|
||||
import { files as bundledFiles } from '../../ts_bundled/bundle.ts';
|
||||
|
||||
export class OpsServer {
|
||||
public objectStorageRef: ObjectStorageContainer;
|
||||
public typedrouter = new plugins.typedrequest.TypedRouter();
|
||||
public server!: plugins.typedserver.utilityservers.UtilityWebsiteServer;
|
||||
|
||||
// Handler instances
|
||||
public adminHandler!: handlers.AdminHandler;
|
||||
public statusHandler!: handlers.StatusHandler;
|
||||
public bucketsHandler!: handlers.BucketsHandler;
|
||||
public objectsHandler!: handlers.ObjectsHandler;
|
||||
public configHandler!: handlers.ConfigHandler;
|
||||
public credentialsHandler!: handlers.CredentialsHandler;
|
||||
public policiesHandler!: handlers.PoliciesHandler;
|
||||
|
||||
constructor(objectStorageRef: ObjectStorageContainer) {
|
||||
this.objectStorageRef = objectStorageRef;
|
||||
}
|
||||
|
||||
public async start(port = 3000) {
|
||||
this.server = new plugins.typedserver.utilityservers.UtilityWebsiteServer({
|
||||
domain: 'localhost',
|
||||
feedMetadata: undefined,
|
||||
bundledContent: bundledFiles,
|
||||
});
|
||||
|
||||
// Chain typedrouters: server -> opsServer -> individual handlers
|
||||
this.server.typedrouter.addTypedRouter(this.typedrouter);
|
||||
|
||||
// Set up all handlers
|
||||
await this.setupHandlers();
|
||||
|
||||
await this.server.start(port);
|
||||
console.log(`OpsServer started on http://localhost:${port}`);
|
||||
}
|
||||
|
||||
private async setupHandlers(): Promise<void> {
|
||||
// AdminHandler requires async initialization for JWT key generation
|
||||
this.adminHandler = new handlers.AdminHandler(this);
|
||||
await this.adminHandler.initialize();
|
||||
|
||||
// All other handlers self-register in their constructors
|
||||
this.statusHandler = new handlers.StatusHandler(this);
|
||||
this.bucketsHandler = new handlers.BucketsHandler(this);
|
||||
this.objectsHandler = new handlers.ObjectsHandler(this);
|
||||
this.configHandler = new handlers.ConfigHandler(this);
|
||||
this.credentialsHandler = new handlers.CredentialsHandler(this);
|
||||
this.policiesHandler = new handlers.PoliciesHandler(this);
|
||||
|
||||
console.log('OpsServer TypedRequest handlers initialized');
|
||||
}
|
||||
|
||||
public async stop() {
|
||||
if (this.server) {
|
||||
await this.server.stop();
|
||||
console.log('OpsServer stopped');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user