This repository was archived by the owner on Sep 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,30 @@ you need to `login` again on a periodic basis:
116116await clientStub .login ();
117117```
118118
119+ ### Create https connection
120+
121+ If your cluster is using tls/mtls you can pass a node ` https.Agent ` configured with you
122+ certificates as follows:
123+
124+ ``` js
125+ const https = require (' https' );
126+ const fs = require (' fs' );
127+ // read your certificates
128+ const cert = fs .readFileSync (' ./certs/client.crt' , ' utf8' );
129+ const ca = fs .readFileSync (' ./certs/ca.crt' , ' utf8' );
130+ const key = fs .readFileSync (' ./certs/client.key' , ' utf8' );
131+
132+ // create your https.Agent
133+ const agent = https .Agent ({
134+ cert,
135+ ca,
136+ key,
137+ })
138+
139+ const clientStub = new dgraph.DgraphClientStub (' https://localhost:8080' , false , {agent});
140+ const dgraphClient = new dgraph.DgraphClient (clientStub);
141+ ```
142+
119143
120144### Alter the database
121145
Original file line number Diff line number Diff line change 1+ import * as https from "https" ;
2+
13export interface Operation {
24 schema ?: string | null ;
35 dropAttr ?: string | null ;
@@ -85,3 +87,11 @@ export interface TxnOptions {
8587export interface ErrorNonJson extends Error {
8688 responseText ?: string ;
8789}
90+
91+ export interface Options extends https . RequestOptions {
92+ agent ?: https . Agent ;
93+ }
94+
95+ export interface Config extends Options {
96+ body ?: string ;
97+ }
You can’t perform that action at this time.
0 commit comments