mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-23 12:55:23 +02:00
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com> Co-authored-by: Danny Martini <danny@n8n.io>
32 lines
899 B
TypeScript
32 lines
899 B
TypeScript
import type { ServiceName } from './services/types';
|
|
import { createN8NStack, type N8NStack } from './stack';
|
|
|
|
export interface ServiceStackOptions {
|
|
services: ServiceName[];
|
|
projectName?: string;
|
|
}
|
|
|
|
/**
|
|
* Creates a stack with only services (no n8n containers).
|
|
* Useful for integration tests that need databases/services but not full n8n.
|
|
*
|
|
* @example
|
|
* const stack = await createServiceStack({ services: ['postgres'] });
|
|
* const pgContainer = stack.serviceResults.postgres?.container;
|
|
* const host = pgContainer.getHost();
|
|
* const port = pgContainer.getMappedPort(5432);
|
|
* await stack.stop();
|
|
*/
|
|
export async function createServiceStack(options: ServiceStackOptions): Promise<N8NStack> {
|
|
const { services, projectName } = options;
|
|
|
|
return await createN8NStack({
|
|
mains: 0,
|
|
workers: 0,
|
|
postgres: services.includes('postgres'),
|
|
services,
|
|
projectName,
|
|
external: true,
|
|
});
|
|
}
|