@@ -109,9 +109,10 @@ connection types:
109109| Type | Purpose | Function Classes |
110110| :----------- | :------------------------------- | :-------------------------- |
111111| ` http ` | Connect to an HTTP(S) web server | ` http ` , ` graphql ` , ` models ` |
112- | ` postgresql ` | Connect to a PostgreSQL database | ` postgresql ` |
113112| ` dgraph ` | Connect to a Dgraph database | ` dgraph ` |
113+ | ` mysql ` | Connect to a MySQL database | ` mysql ` |
114114| ` neo4j ` | Connect to a Neo4j database | ` neo4j ` |
115+ | ` postgresql ` | Connect to a PostgreSQL database | ` postgresql ` |
115116
116117<Warning >
117118** Don't include secrets directly in the manifest!**
@@ -246,88 +247,83 @@ This example specifies a query parameter named `key` provided by a secret named
246247 </Accordion >
247248</ResponseField >
248249
249- ### PostgreSQL connection
250+ ### Dgraph connection
250251
251- This connection type supports connecting to PostgreSQL databases. You can use
252- the [ PostgreSQL APIs] ( /modus/sdk/postgresql ) in the Modus SDK to interact with
253- the database.
252+ This connection type supports connecting to Dgraph databases. You can use the
253+ [ Dgraph APIs] ( /modus/sdk/dgraph ) in the Modus SDK to interact with the database.
254254
255255** Example:**
256256
257257``` json modus.json
258258{
259259 "connections" : {
260- "my-database" : {
261- "type" : " postgresql" ,
262- "connString" : " postgresql://{{PG_USER}}:{{PG_PASSWORD}}@db.example.com:5432/data?sslmode=require"
260+ "my-dgraph" : {
261+ "type" : " dgraph" ,
262+ "grpcTarget" : " frozen-mango.grpc.eu-central-1.aws.cloud.dgraph.io:443" ,
263+ "key" : " {{DGRAPH_API_KEY}}"
263264 }
264265 }
265266}
266267```
267268
268269<ResponseField name = " type" type = " string" required >
269- Always set to ` "postgresql " ` for this connection type.
270+ Always set to ` "dgraph " ` for this connection type.
270271</ResponseField >
271272
272- <ResponseField name = " connString" type = " string" required >
273- The connection string for the PostgreSQL database.
274-
275- Values may include variables using the ` {{VARIABLE}} ` template syntax, which
276- resolve at runtime to secrets provided for each connection, via the Hypermode
277- Console.
278-
279- The connection string in the preceding example includes:
280-
281- - A username and password provided by secrets named ` PG_USER ` & ` PG_PASSWORD `
282- - A host named ` db.example.com ` on port ` 5432 `
283- - A database named ` data `
284- - SSL mode set to ` require ` - which is highly recommended for secure connections
285-
286- Refer to
287- [ the PostgreSQL documentation] ( https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING )
288- for more details on connection strings.
289-
290- <Tip >
291-
292- Managed PostgreSQL providers often provide a pre-made connection string for you
293- to copy. Check your provider's documentation for details.
294-
295- For example, if using Neon, refer to the
296- [ Neon documentation] ( https://neon.tech/docs/connect/connect-from-any-app ) .
297-
298- </Tip >
273+ <ResponseField name = " grpcTarget" type = " string" required >
274+ The gRPC target for the Dgraph database.
275+ </ResponseField >
299276
277+ <ResponseField name = " key" type = " string" required >
278+ The API key for the Dgraph database.
300279</ResponseField >
301280
302- ### Dgraph connection
281+ ### MySQL connection
303282
304- This connection type supports connecting to Dgraph databases. You can use the
305- [ Dgraph APIs] ( /modus/sdk/dgraph ) in the Modus SDK to interact with the database.
283+ This connection type supports connecting to MySQL databases. You can use the
284+ [ MySQL APIs] ( /modus/sdk/mysql ) in the Modus SDK to interact with the database.
306285
307286** Example:**
308287
309288``` json modus.json
310289{
311290 "connections" : {
312- "my-dgraph" : {
313- "type" : " dgraph" ,
314- "grpcTarget" : " frozen-mango.grpc.eu-central-1.aws.cloud.dgraph.io:443" ,
315- "key" : " {{DGRAPH_API_KEY}}"
291+ "my-database" : {
292+ "type" : " mysql" ,
293+ "connString" : " mysql://{{USERNAME}}:{{PASSWORD}}@db.example.com:3306/dbname?tls=true"
316294 }
317295 }
318296}
319297```
320298
321299<ResponseField name = " type" type = " string" required >
322- Always set to ` "dgraph " ` for this connection type.
300+ Always set to ` "mysql " ` for this connection type.
323301</ResponseField >
324302
325- <ResponseField name = " grpcTarget" type = " string" required >
326- The gRPC target for the Dgraph database.
327- </ResponseField >
303+ <ResponseField name = " connString" type = " string" required >
304+ The connection string for the MySQL database.
305+
306+ Values may include variables using the ` {{VARIABLE}} ` template syntax, which
307+ resolve at runtime to secrets provided for each connection, via the Hypermode
308+ Console.
309+
310+ The connection string in the preceding example includes:
311+
312+ - A username and password provided by secrets named ` USERNAME ` & ` PASSWORD `
313+ - A host named ` db.example.com ` on port ` 3306 `
314+ - A database named ` dbname `
315+ - Encryption enabled via ` tls=true ` - which is highly recommended for secure
316+ connections
317+
318+ Set the connection string using a URI format
319+ [ as described in the MySQL documentation] ( https://dev.mysql.com/doc/refman/8.4/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri ) .
320+
321+ However, any optional parameters provided should be in the form specified by the
322+ Go MySQL driver used by the Modus Runtime,
323+ [ as described here] ( https://github.com/go-sql-driver/mysql/blob/master/README.md#parameters )
324+
325+ For example, use ` tls=true ` to enable encryption (not ` sslmode=require ` ).
328326
329- <ResponseField name = " key" type = " string" required >
330- The API key for the Dgraph database.
331327</ResponseField >
332328
333329### Neo4j connection
@@ -366,6 +362,59 @@ This connection type supports connecting to Neo4j databases. You can use the
366362 The password for the Neo4j database.
367363</ResponseField >
368364
365+ ### PostgreSQL connection
366+
367+ This connection type supports connecting to PostgreSQL databases. You can use
368+ the [ PostgreSQL APIs] ( /modus/sdk/postgresql ) in the Modus SDK to interact with
369+ the database.
370+
371+ ** Example:**
372+
373+ ``` json modus.json
374+ {
375+ "connections" : {
376+ "my-database" : {
377+ "type" : " postgresql" ,
378+ "connString" : " postgresql://{{PG_USER}}:{{PG_PASSWORD}}@db.example.com:5432/data?sslmode=require"
379+ }
380+ }
381+ }
382+ ```
383+
384+ <ResponseField name = " type" type = " string" required >
385+ Always set to ` "postgresql" ` for this connection type.
386+ </ResponseField >
387+
388+ <ResponseField name = " connString" type = " string" required >
389+ The connection string for the PostgreSQL database.
390+
391+ Values may include variables using the ` {{VARIABLE}} ` template syntax, which
392+ resolve at runtime to secrets provided for each connection, via the Hypermode
393+ Console.
394+
395+ The connection string in the preceding example includes:
396+
397+ - A username and password provided by secrets named ` PG_USER ` & ` PG_PASSWORD `
398+ - A host named ` db.example.com ` on port ` 5432 `
399+ - A database named ` data `
400+ - SSL mode set to ` require ` - which is highly recommended for secure connections
401+
402+ Refer to
403+ [ the PostgreSQL documentation] ( https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING )
404+ for more details on connection strings.
405+
406+ <Tip >
407+
408+ Managed PostgreSQL providers often provide a pre-made connection string for you
409+ to copy. Check your provider's documentation for details.
410+
411+ For example, if using Neon, refer to the
412+ [ Neon documentation] ( https://neon.tech/docs/connect/connect-from-any-app ) .
413+
414+ </Tip >
415+
416+ </ResponseField >
417+
369418### Working locally with secrets
370419
371420When you run your app locally using ` modus dev ` , the runtime replaces the
0 commit comments