feat(opsserver): Serve bundled frontend from a dedicated dist_serve directory and update frontend UI/packaging
This commit is contained in:
@@ -2,12 +2,11 @@ import * as plugins from '../plugins.ts';
|
||||
import { logger } from '../logging.ts';
|
||||
import type { GitopsApp } from '../classes/gitopsapp.ts';
|
||||
import * as handlers from './handlers/index.ts';
|
||||
import { files as bundledFiles } from '../../ts_bundled/bundle.ts';
|
||||
|
||||
export class OpsServer {
|
||||
public gitopsAppRef: GitopsApp;
|
||||
public typedrouter = new plugins.typedrequest.TypedRouter();
|
||||
public server!: plugins.typedserver.TypedServer;
|
||||
public server!: plugins.typedserver.utilityservers.UtilityWebsiteServer;
|
||||
|
||||
// Handler instances
|
||||
public adminHandler!: handlers.AdminHandler;
|
||||
@@ -23,14 +22,11 @@ export class OpsServer {
|
||||
}
|
||||
|
||||
public async start(port = 3000) {
|
||||
this.server = new plugins.typedserver.TypedServer({
|
||||
port,
|
||||
cors: true,
|
||||
bundledContent: bundledFiles,
|
||||
spaFallback: true,
|
||||
injectReload: true,
|
||||
watch: true,
|
||||
compression: true,
|
||||
const absoluteServeDir = plugins.path.resolve('./dist_serve');
|
||||
this.server = new plugins.typedserver.utilityservers.UtilityWebsiteServer({
|
||||
domain: 'localhost',
|
||||
feedMetadata: undefined,
|
||||
serveDir: absoluteServeDir,
|
||||
});
|
||||
|
||||
// Chain typedrouters
|
||||
@@ -39,7 +35,7 @@ export class OpsServer {
|
||||
// Set up all handlers
|
||||
await this.setupHandlers();
|
||||
|
||||
await this.server.start();
|
||||
await this.server.start(port);
|
||||
logger.success(`OpsServer started on http://localhost:${port}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user