INNER CODE UNIT · TypeScript

toPort

rodyherrera/Quantum · packages/api/scripts/seed-templates.ts:288

const toPort = (port: LegacyPort) => ({ target: Number(port.internalPort), protocol: port.protocol });

const toVolume = (volume: LegacyVolume) => ({ path: volume.containerPath, mode: volume.mode });

const resolvePlaceholders = (value: string, dependencies: Record<string, LegacyDependency>): string =>
    value
        .replace(/\{server_ip:(\w+)\}/g, (_, key: string) => key)
        .replace(/\$\{(\w+)\.port\}/g, (_, key: string) => {
            const port = dependencies[key]?.ports?.[0]?.internalPort;
            return port !== undefined ? String(port) : '';
        });

const resolveEnvironment = (
    environment: Record<string, string> | undefined,
    dependencies: Record<string, LegacyDependency>
): Record<string, string> | undefined => {
    if(!environment) return undefined;
    const resolved: Record<string, string> = {};

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…