46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
|
|
#!/usr/bin/env -S deno run --allow-all
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Spark - Server Configuration and Management Tool
|
||
|
|
*
|
||
|
|
* A comprehensive tool for maintaining and configuring servers, integrating
|
||
|
|
* with Docker and supporting advanced task scheduling, targeted at the Servezone
|
||
|
|
* infrastructure and used by @serve.zone/cloudly as a cluster node server system manager.
|
||
|
|
*
|
||
|
|
* Required Permissions:
|
||
|
|
* - --allow-net: API communication, Docker access
|
||
|
|
* - --allow-read: Configuration files, project files
|
||
|
|
* - --allow-write: Logs, configuration updates
|
||
|
|
* - --allow-run: systemctl, Docker commands
|
||
|
|
* - --allow-env: Environment variables
|
||
|
|
* - --allow-sys: System information
|
||
|
|
*
|
||
|
|
* @module
|
||
|
|
*/
|
||
|
|
|
||
|
|
import * as cli from './ts/spark.cli.ts';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Main entry point for the Spark application
|
||
|
|
* Sets up the CLI environment and executes the requested command
|
||
|
|
*/
|
||
|
|
async function main(): Promise<void> {
|
||
|
|
// Set environment variable to indicate CLI call
|
||
|
|
Deno.env.set('CLI_CALL', 'true');
|
||
|
|
|
||
|
|
// Execute the CLI
|
||
|
|
await cli.runCli();
|
||
|
|
}
|
||
|
|
|
||
|
|
// Execute main and handle errors
|
||
|
|
if (import.meta.main) {
|
||
|
|
try {
|
||
|
|
await main();
|
||
|
|
} catch (error) {
|
||
|
|
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
||
|
|
Deno.exit(1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Export for library usage
|
||
|
|
export * from './ts/spark.classes.spark.ts';
|