From ef90a5a1b43acf0196a167d5ae7aebd97b9e6c70 Mon Sep 17 00:00:00 2001 From: Ally Shaban Date: Thu, 15 Jul 2021 20:32:46 +0300 Subject: [PATCH] example of how to update config --- tests/updateConfig.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/updateConfig.js diff --git a/tests/updateConfig.js b/tests/updateConfig.js new file mode 100644 index 00000000..1c705571 --- /dev/null +++ b/tests/updateConfig.js @@ -0,0 +1,37 @@ +const fs = require('fs'); +const async = require('async'); +const path = require('path'); +const request = require('request'); +const uploadResults = require('./uploadResults'); +const logger = require('../server/lib/winston'); + + + +const agentOptions = { + cert: fs.readFileSync( + '../server/clientCertificates/openmrs_cert.pem' + ), + key: fs.readFileSync( + '../server/clientCertificates/openmrs_key.pem' + ), + ca: fs.readFileSync('../server/serverCertificates/server_cert.pem'), + securityOptions: 'SSL_OP_NO_SSLv3', +}; +const auth = { + username: 'openmrs', + password: 'openmrs' +}; +const options = { + url: 'https://localhost:3000/updateConfig/', + agentOptions, + // auth, + json: [ + { "systems:internalid:uri": ["http://openmrs.org/openmrs2", "http://dhis2.org/internalid"] } + ], +}; +request.post(options, (err, res, body) => { + if(err) { + logger.error(err); + } + logger.info(body) +});