@@ -4,7 +4,7 @@ import { execa, type ResultPromise } from 'execa'
44import mergeOptions from 'merge-options'
55import pDefer from 'p-defer'
66import waitFor from 'p-wait-for'
7- import { checkForRunningApi , tmpDir , buildStartArgs , repoExists , buildInitArgs } from './utils.js'
7+ import { checkForRunningApi , tmpDir , buildStartArgs , repoExists , buildInitArgs , getGatewayAddress } from './utils.js'
88import type { KuboNode , KuboInfo , KuboInitOptions , KuboOptions , KuboStartOptions , KuboStopOptions } from './index.js'
99import type { Logger } from '@libp2p/interface'
1010import type { KuboRPCClient } from 'kubo-rpc-client'
@@ -27,7 +27,6 @@ export default class KuboDaemon implements KuboNode {
2727 private readonly disposable : boolean
2828 private subprocess ?: ResultPromise
2929 private _api ?: KuboRPCClient
30- private _gateway ?: string
3130 private readonly repo : string
3231 private readonly stdout : Logger
3332 private readonly stderr : Logger
@@ -93,7 +92,7 @@ export default class KuboDaemon implements KuboNode {
9392 multiaddrs : ( id ?. addresses ?? [ ] ) . map ( ma => ma . toString ( ) ) ,
9493 api : checkForRunningApi ( this . repo ) ,
9594 repo : this . repo ,
96- gateway : this . _gateway ?? ''
95+ gateway : getGatewayAddress ( this . repo )
9796 }
9897 }
9998
@@ -204,16 +203,11 @@ export default class KuboDaemon implements KuboNode {
204203 const readyHandler = ( data : Buffer ) : void => {
205204 output += data . toString ( )
206205 const apiMatch = output . trim ( ) . match ( / A P I .* l i s t e n i n g o n : ? ( .* ) / )
207- const gwMatch = output . trim ( ) . match ( / G a t e w a y .* l i s t e n i n g o n : ? ( .* ) / )
208206
209207 if ( ( apiMatch != null ) && apiMatch . length > 0 ) {
210208 this . _api = this . options . rpc ( apiMatch [ 1 ] )
211209 }
212210
213- if ( ( gwMatch != null ) && gwMatch . length > 0 ) {
214- this . _gateway = gwMatch [ 1 ]
215- }
216-
217211 if ( output . match ( / (?: d a e m o n i s r u n n i n g | D a e m o n i s r e a d y ) / ) != null ) {
218212 // we're good
219213 stdout . off ( 'data' , readyHandler )
0 commit comments