@@ -254,14 +254,59 @@ This connection type supports connecting to Dgraph databases. You can use the
254
254
[ Dgraph APIs] ( /modus/sdk/assemblyscript/dgraph ) in the Modus SDK to interact
255
255
with the database.
256
256
257
+ There are two ways to connect to Dgraph:
258
+
259
+ - [ Using a connection string] ( #using-a-dgraph-connection-string ) (preferred
260
+ method)
261
+ - [ Using a gRPC target] ( #using-a-dgraph-grpc-target ) (older method)
262
+
263
+ You can use either approach in Modus, but not both.
264
+
265
+ #### Using a Dgraph connection string
266
+
267
+ This is the preferred method for connecting to Dgraph. It uses a simplified URI
268
+ based connection string to specify all options, including host, port, options,
269
+ and authentication.
270
+
271
+ ** Example:**
272
+
273
+ ``` json modus.json
274
+ {
275
+ "connections" : {
276
+ "my-dgraph" : {
277
+ "type" : " dgraph" ,
278
+ "connString" : " dgraph://example.hypermode.host:443?sslmode=verify-ca&bearertoken={{DGRAPH_API_KEY}}"
279
+ }
280
+ }
281
+ }
282
+ ```
283
+
284
+ <ResponseField name = " type" type = " string" required >
285
+ Always set to ` "dgraph" ` for this connection type.
286
+ </ResponseField >
287
+
288
+ <ResponseField name = " connString" type = " string" required >
289
+ The connection string for the Dgraph database, in URI format.
290
+ </ResponseField >
291
+
292
+ #### Using a Dgraph gRPC target
293
+
294
+ This is the older method for connecting to Dgraph. It uses a gRPC target to
295
+ specify the host and port, and a separate key for authentication. It
296
+ automatically uses SSL mode (with full CA verification) for the connection -
297
+ _ except_ when connecting to ` localhost ` .
298
+
299
+ Additional options such as username/password authentication aren't supported. If
300
+ you need to use these options, use the connection string method instead.
301
+
257
302
** Example:**
258
303
259
304
``` json modus.json
260
305
{
261
306
"connections" : {
262
307
"my-dgraph" : {
263
308
"type" : " dgraph" ,
264
- "grpcTarget" : " frozen-mango .grpc.eu-central-1 .aws.cloud.dgraph.io:443" ,
309
+ "grpcTarget" : " example .grpc.region .aws.cloud.dgraph.io:443" ,
265
310
"key" : " {{DGRAPH_API_KEY}}"
266
311
}
267
312
}
0 commit comments