Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
Fix #1220
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderChen1989 committed Nov 9, 2017
1 parent dee6648 commit f79ad6b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cli/packages/graphcool-cli-engine/src/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,10 @@ Please run ${chalk.bold('graphcool local up')} to start the local cluster.`)
return this.subscriptionURL({ region, projectId })
}

const match = this.clusterEndpoint.match(/.*:(\d+)\/?.*/)
const localPort = match ? match[1] : '60000'
return this.subscriptionURL({ localPort, projectId })
const match = this.clusterEndpoint.match(/https?:\/\/(.*):(\d+)\/?.*/)
const localAddr = match ? match[1] : 'localhost'
const localPort = match ? match[2] : '60000'
return this.subscriptionURL({ localAddr, localPort, projectId })
}

private setTestToken() {
Expand All @@ -669,14 +670,16 @@ Please run ${chalk.bold('graphcool local up')} to start the local cluster.`)
private subscriptionURL = ({
region,
projectId,
localAddr,
localPort,
}: {
region?: Region
projectId: string
localAddr?: string
localPort?: number | string
}) =>
localPort
? `ws://localhost:${localPort}/subscriptions/v1/${projectId}`
? `ws://${localAddr}:${localPort}/subscriptions/v1/${projectId}`
: `${subscriptionEndpoints[region!]}/v1/${projectId}`
}

Expand Down

0 comments on commit f79ad6b

Please sign in to comment.