1import { enterKlusterCtxs } from '../../k8sF/ctxF/klusterCtxF.mts'2import { syncIpfs } from './templatesAI.mts'3import { handleIpfsAction, ensureAnnounceAddrs, ensurePeeringConfig } from './ipfsActionsF.mts'4import { getAction } from '../../ctxF/actionCtxF.mts'5import { appCfgCtx } from '../../k8sF/ctxF/appCfgCtxF.mts'6import { isDirectlyRun } from '../../../serverF/isDirectlyRunF.mts'7import { type importMetaUrlType } from '../../../ptDirF.mts'9export const eptKuboIpfs = async ({klusterCfg, hostname, apiHostname, peerConfig, inputPath, importMetaUrl}: {klusterCfg: any, hostname: string, apiHostname: string, peerConfig: any, inputPath?: string, importMetaUrl?: string}) => {10 const fullConfig = {klusterCfg, hostname, apiHostname, peerConfig, inputPath, importMetaUrl}11 if (importMetaUrl && !isDirectlyRun(importMetaUrl)) return fullConfig13 enterKlusterCtxs(klusterCfg)14 if (importMetaUrl) appCfgCtx.enterWith({importMetaUrl: importMetaUrl as importMetaUrlType})17 const handled = await handleIpfsAction({18 action,19 apiUrl: `https://${apiHostname}`,20 gatewayUrl: `https://${hostname}/ipfs`,21 peerConfig,22 inputPath23 })25 if (!handled) {26 const isPrivate = peerConfig?.isPrivate ?? !peerConfig?.externalIp28 const apiUrl = `https://${apiHostname}`29 if (peerConfig?.externalIp) await ensureAnnounceAddrs({apiUrl, peerConfig})30 await ensurePeeringConfig({apiUrl})31 }32}