Browse Source

Fix DEBUG environment variable check

Vadim Aleksandrov 1 year ago
parent
commit
f010235ff2
3 changed files with 6 additions and 6 deletions
  1. 1 1
      imports/i18n/tap.js
  2. 4 4
      packages/wekan-oidc/oidc_server.js
  3. 1 1
      server/authentication.js

+ 1 - 1
imports/i18n/tap.js

@@ -20,7 +20,7 @@ export const TAPi18n = {
       cleanCode: true,
       // Show translations debug messages only when DEBUG=true
       // OLD: debug: Meteor.isDevelopment,
-      debug: process.env.DEBUG,
+      debug: process.env.DEBUG === 'true',
       supportedLngs: Object.values(languages).map(({ tag }) => tag),
       ns: DEFAULT_NAMESPACE,
       defaultNs: DEFAULT_NAMESPACE,

+ 4 - 4
packages/wekan-oidc/oidc_server.js

@@ -19,7 +19,7 @@ var serviceData = {};
 var userinfo = {};
 
 OAuth.registerService('oidc', 2, null, function (query) {
-  var debug = process.env.DEBUG || false;
+  var debug = process.env.DEBUG === 'true';
 
   var token = getToken(query);
   if (debug) console.log('XXX: register token:', token);
@@ -135,7 +135,7 @@ if (Meteor.release) {
 
 if (process.env.ORACLE_OIM_ENABLED !== 'true' && process.env.ORACLE_OIM_ENABLED !== true) {
   var getToken = function (query) {
-    var debug = process.env.DEBUG || false;
+    var debug = process.env.DEBUG === 'true';
     var config = getConfiguration();
     if(config.tokenEndpoint.includes('https://')){
       var serverTokenEndpoint = config.tokenEndpoint;
@@ -181,7 +181,7 @@ if (process.env.ORACLE_OIM_ENABLED !== 'true' && process.env.ORACLE_OIM_ENABLED
 if (process.env.ORACLE_OIM_ENABLED === 'true' || process.env.ORACLE_OIM_ENABLED === true) {
 
   var getToken = function (query) {
-    var debug = (process.env.DEBUG === 'true' || process.env.DEBUG === true) || false;
+    var debug = process.env.DEBUG === 'true';
     var config = getConfiguration();
     if(config.tokenEndpoint.includes('https://')){
       var serverTokenEndpoint = config.tokenEndpoint;
@@ -240,7 +240,7 @@ if (process.env.ORACLE_OIM_ENABLED === 'true' || process.env.ORACLE_OIM_ENABLED
 
 
 var getUserInfo = function (accessToken) {
-  var debug = process.env.DEBUG || false;
+  var debug = process.env.DEBUG === 'true';
   var config = getConfiguration();
   // Some userinfo endpoints use a different base URL than the authorization or token endpoints.
   // This logic allows the end user to override the setting by providing the full URL to userinfo in their config.

+ 1 - 1
server/authentication.js

@@ -129,7 +129,7 @@ Meteor.startup(() => {
             validateUrl: process.env.CASE_VALIDATE_URL,
             casVersion: 3.0,
             attributes: {
-              debug: process.env.DEBUG,
+              debug: process.env.DEBUG === 'true',
             },
           },
         },