Skip to content

Commit

Permalink
cli: fix demo endpoint generation
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed May 8, 2018
1 parent 40adf93 commit e3e0931
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cli/packages/prisma-cli-core/src/utils/EndpointDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ export class EndpointDialog {
stage = await this.askForStage('dev')
}

workspace = workspace || cluster.workspaceSlug

return {
endpoint: cluster.getApiEndpoint(service, stage, workspace),
cluster,
Expand Down
18 changes: 18 additions & 0 deletions cli/packages/prisma-yml/src/PrismaDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ export class PrismaDefinitionClass {
const clusterName = this.getClusterName()
const cluster = this.env.clusterByName(clusterName!)!
if (
this.definition &&
this.definition.cluster &&
clusterName &&
cluster &&
cluster.shared &&
Expand All @@ -177,6 +179,22 @@ and execute ${chalk.bold.green(
)} again, to get that value auto-filled.`,
)
}
if (
this.definition &&
this.definition.endpoint &&
clusterName &&
cluster &&
cluster.shared &&
!cluster.isPrivate &&
!this.getWorkspace() &&
clusterName !== 'shared-public-demo'
) {
throw new Error(
`The provided endpoint ${
this.definition.endpoint
} points to a demo cluster, but is missing the workspace slug. A valid demo endpoint looks like this: https://eu1.prisma.sh/myworkspace/service-name/stage-name`,
)
}
this.env.sharedClusters
}

Expand Down

0 comments on commit e3e0931

Please sign in to comment.