diff --git a/src/main.js b/src/main.js index 87e5d2c..dc07753 100755 --- a/src/main.js +++ b/src/main.js @@ -125,7 +125,7 @@ var App = { Conf.odbcDriver ); - //Datasources creation + // Datasources creation this.createDatasources(); // Upload the string value to version installed @@ -201,6 +201,7 @@ var App = { updateODBC: function(path, dsName, datasource) { var params; + // ToDo → Transform variable to property if (datasource == 'production') params = Conf.datasources.production @@ -383,19 +384,39 @@ var App = { */ fetchVersion: function() { // Gets the last version number using the MySQL ODBC connection - + var mysqlConn = new ActiveXObject('ADODB.Connection');; + var datasource = this.getDatasource(); + var serverURL; + var sslMode; + + // ToDo → Transform variable to property + if (datasource == 'production') + serverURL = Conf.datasources.production.SERVER + sslMode = Conf.datasources.production.SSLMODE + + if (datasource == 'test') + serverURL = Conf.datasources.test.SERVER + sslMode = Conf.datasources.test.SSLMODE + + if (datasource == 'dev') + serverURL = Conf.datasources.dev.SERVER + sslMode = Conf.datasources.dev.SSLMODE + + if (datasource == 'localhost') + serverURL = Conf.datasources.localhost.SERVER + sslMode = Conf.datasources.localhost.SSLMODE try { mysqlConn.open(this.getODBCString({ Driver: '{'+ Conf.odbcDriver +'}', - Server: Conf.datasources.production.SERVER, - Database: Conf.dbName, - Uid: this.$('user').value, - Pwd: this.$('password').value, - Sslca: this.certFile, - SslMode: 'VERIFY_IDENTITY', - SslCipher: 'AES256-SHA', + SERVER: serverURL, + DATABASE: Conf.dbName, + UID: this.$('user').value, + PWD: this.$('password').value, + SSLCA: this.certFile, + SSLMODE: sslMode, + SSLCIPHER: 'AES256-SHA', ENABLE_CLEARTEXT_PLUGIN : 1 })); } catch (err) {