Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/258122

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, 19 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/22/258122/1

diff --git a/config.dev.yaml b/config.dev.yaml
index c110c32..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
@@ -733,7 +737,7 @@
               - kk
             ur:
               - hi
-        Yandex:
+          Yandex:
             en:
               - ru
         dictionary:
diff --git a/config.prod.yaml b/config.prod.yaml
index 50566f6..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
@@ -734,7 +738,7 @@
               - kk
             ur:
               - hi
-        Yandex:
+          Yandex:
             en:
               - ru
         dictionary:
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: newchange
Gerrit-Change-Id: I039ad64247718fa1a81147cf20b7152a829eb549
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

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

Reply via email to