🌳
pt0/deployF/servicesF/ipfsF/eptKuboIpfsF.mts
2import { syncIpfs } from './templatesAI.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 fullConfig
13 enterKlusterCtxs(klusterCfg)
14 if (importMetaUrl) appCfgCtx.enterWith({importMetaUrl: importMetaUrl as importMetaUrlType})
15 const action = getAction()
17 const handled = await handleIpfsAction({
18 action,
19 apiUrl: `https://${apiHostname}`,
20 gatewayUrl: `https://${hostname}/ipfs`,
21 peerConfig,
22 inputPath
23 })
25 if (!handled) {
26 const isPrivate = peerConfig?.isPrivate ?? !peerConfig?.externalIp
27 await syncIpfs({hostname, apiHostname, peerConfig: {isPrivate, ...peerConfig}})
28 const apiUrl = `https://${apiHostname}`
29 if (peerConfig?.externalIp) await ensureAnnounceAddrs({apiUrl, peerConfig})
30 await ensurePeeringConfig({apiUrl})
31 }