Refactor code structure for improved readability and maintainability
This commit is contained in:
14
ts/cli.ts
14
ts/cli.ts
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
import * as plugins from './plugins.ts';
|
||||
import { StackGalleryRegistry, createRegistryFromEnv } from './registry.ts';
|
||||
import { StackGalleryRegistry, createRegistryFromEnv, createRegistryFromEnvFile } from './registry.ts';
|
||||
import { initDb } from './models/db.ts';
|
||||
import { User, Organization, OrganizationMember, Repository } from './models/index.ts';
|
||||
import { AuthService } from './services/auth.service.ts';
|
||||
@@ -13,9 +13,17 @@ export async function runCli(): Promise<void> {
|
||||
|
||||
// Server command
|
||||
smartcliInstance.addCommand('server').subscribe(async (argsParsed) => {
|
||||
console.log('Starting Stack.Gallery Registry...');
|
||||
const isEphemeral = argsParsed.ephemeral || argsParsed.e;
|
||||
|
||||
const registry = createRegistryFromEnv();
|
||||
console.log('Starting Stack.Gallery Registry...');
|
||||
if (isEphemeral) {
|
||||
console.log('[CLI] Ephemeral mode enabled - loading config from .nogit/env.json');
|
||||
}
|
||||
|
||||
// Use env file in ephemeral/dev mode, otherwise use environment variables
|
||||
const registry = isEphemeral
|
||||
? await createRegistryFromEnvFile()
|
||||
: createRegistryFromEnv();
|
||||
await registry.start();
|
||||
|
||||
// Handle shutdown gracefully
|
||||
|
||||
Reference in New Issue
Block a user