jenkins-bot has submitted this change and it was merged.

Change subject: Yandex: Allow setting server certificate
......................................................................


Yandex: Allow setting server certificate

This is only required to avoid nodejs 0.10.x versions in Ubuntu 14.04
rejecting translate.yandex.net certificate.

Change-Id: I039ad64247718fa1a81147cf20b7152a829eb549
---
M config.dev.yaml
M config.prod.yaml
M mt/Yandex.js
3 files changed, 17 insertions(+), 1 deletion(-)

Approvals:
  KartikMistry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/config.dev.yaml b/config.dev.yaml
index e414f2a..43b14e3 100644
--- a/config.dev.yaml
+++ b/config.dev.yaml
@@ -60,6 +60,10 @@
         yandex:
           api: https://translate.yandex.net
           key: null
+          # SSL certificate of yandex server. Only required while using Node 
0.10.x on Ubuntu
+          # Setting a value like 
'/etc/ssl/certs/Certum_Trusted_Network_CA.pem' will help
+          # to prevent certificate rejection by nodejs.
+          certificate: null
       registry:
         source:
           - ab
diff --git a/config.prod.yaml b/config.prod.yaml
index 3116ccf..d49f143 100644
--- a/config.prod.yaml
+++ b/config.prod.yaml
@@ -61,6 +61,10 @@
           api: https://translate.yandex.net
           proxy: http://url-downloader.wikimedia.org:8080
           key: null
+          # SSL certificate of yandex server. Only required while using Node 
0.10.x on Ubuntu
+          # Setting a value like 
'/etc/ssl/certs/Certum_Trusted_Network_CA.pem' will help
+          # to prevent certificate rejection by nodejs.
+          certificate: null
       registry:
         source:
           - ab
diff --git a/mt/Yandex.js b/mt/Yandex.js
index 4dff4e0..bc399fa 100644
--- a/mt/Yandex.js
+++ b/mt/Yandex.js
@@ -1,8 +1,10 @@
 var
        util = require( 'util' ),
        preq = require( 'preq' ),
+       fs = require( 'fs' ),
        BBPromise = require( 'bluebird' ),
-       MTClient = require( './MTClient.js' );
+       MTClient = require( './MTClient.js' ),
+       certificate;
 
 function Yandex( options ) {
        this.logger = options.logger;
@@ -46,6 +48,12 @@
                }
        };
 
+       if ( this.conf.mt.yandex.certificate ) {
+               certificate = certificate || fs.readFileSync( 
this.conf.mt.yandex.certificate );
+               postData.agentOptions = {
+                       ca: certificate
+               };
+       }
        return preq.post( postData ).then( function ( response ) {
                return response.body.text[ 0 ];
        } );

-- 
To view, visit https://gerrit.wikimedia.org/r/258122
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I039ad64247718fa1a81147cf20b7152a829eb549
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>
Gerrit-Reviewer: KartikMistry <kartik.mis...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to