From 24876652867c6d8b696a408f3127a300181ad2e6 Mon Sep 17 00:00:00 2001
From: Yannis Barlas <yannisbarlas@gmail.com>
Date: Tue, 10 Jan 2023 16:00:37 +0200
Subject: [PATCH] fix(server): move config services into get access token fn

---
 src/utils/getAccessToken.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/utils/getAccessToken.js b/src/utils/getAccessToken.js
index d36f827..7db925c 100644
--- a/src/utils/getAccessToken.js
+++ b/src/utils/getAccessToken.js
@@ -4,10 +4,10 @@ const axios = require('axios')
 
 const { ServiceCredential } = require('../models')
 
-const services = config.get('services')
-
 const getAccessToken = async (serviceName, renew = false) => {
   try {
+    const services = config.has('services') && config.get('services')
+
     if (!services) {
       throw new Error('services are undefined')
     }
-- 
GitLab