Skip to content

Commit

Permalink
clusterInfo for backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dpetrick committed May 8, 2018
1 parent 00c8156 commit c60fa55
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ case class SchemaBuilderImpl(
listMigrationsField,
projectField,
serverInfoField,
clusterInfoField,
generateProjectTokenField
)

Expand Down Expand Up @@ -147,6 +148,14 @@ case class SchemaBuilderImpl(
resolve = (ctx) => ()
)

// Deprecated, will be removed soon
val clusterInfoField: Field[SystemUserContext, Unit] = Field(
"clusterInfo",
ServerInfoType.Type,
description = Some("Information about the server"),
resolve = (ctx) => ()
)

val generateProjectTokenField: Field[SystemUserContext, Unit] = Field(
"generateProjectToken",
StringType,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.prisma.deploy.schema.types

import com.prisma.deploy.schema.SystemUserContext
import sangria.schema._

object ClusterInfoType {
val version = sys.env.getOrElse("CLUSTER_VERSION", sys.error("Env var CLUSTER_VERSION required but not found."))
val commit = sys.env.getOrElse("COMMIT_SHA", sys.error("Env var COMMIT_SHA required but not found."))

lazy val Type: ObjectType[SystemUserContext, Unit] = ObjectType(
"ClusterInfo",
"Information about the deployed server",
fields[SystemUserContext, Unit](
Field("version", StringType, resolve = _ => version),
Field("commit", StringType, resolve = _ => commit)
)
)
}

0 comments on commit c60fa55

Please sign in to comment.