From c1b66bb158ebc1c0c791e79aaff99999189943fa Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Wed, 10 Aug 2022 11:32:50 +0200
Subject: [PATCH] publish: fix: env variable + add city field

generated from commit 7a9ecb677963d5cab69eec5c4e769372d95db9d1
---
 index.js | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/index.js b/index.js
index 3b68780..2f01124 100644
--- a/index.js
+++ b/index.js
@@ -38,7 +38,7 @@ const { verifyContract } = __webpack_require__(1599)
 const { terminateContract } = __webpack_require__(1601)
 const { getContractStartDate } = __webpack_require__(1602)
 const { getAccount, saveAccountData } = __webpack_require__(1603)
-const { getAccountId } = __webpack_require__(1605)
+const { iSLocal } = __webpack_require__(1604)
 
 moment.locale('fr') // set the language
 moment.tz.setDefault('Europe/Paris') // set the timezone
@@ -53,6 +53,7 @@ let startDailyDateString = startDailyDate.format('YYYY-MM-DD')
 const startLoadDate = moment().subtract(7, 'day')
 const endDate = moment()
 const endDateString = endDate.format('YYYY-MM-DD')
+const ACCOUNT_ID = iSLocal() ? 'default_account_id' : 'enedis-sge-grandlyon'
 
 module.exports = new BaseKonnector(start)
 
@@ -67,7 +68,7 @@ module.exports = new BaseKonnector(start)
  */
 async function start(fields, cozyParameters) {
   log('info', 'Konnector configuration ...')
-  const ACCOUNT_ID = await getAccountId()
+
   const pointId = fields.pointId
   let baseUrl = fields.wso2BaseUrl
   let apiAuthKey = fields.apiToken
@@ -228295,24 +228296,6 @@ function iSLocal() {
 module.exports = { iSLocal }
 
 
-/***/ }),
-/* 1605 */
-/***/ ((module) => {
-
-function getAccountId() {
-  try {
-    return process.env.NODE_ENV === 'development' ||
-      process.env.NODE_ENV === 'test'
-      ? 'fakeAccountId'
-      : JSON.parse(process.env.COZY_FIELDS).account
-  } catch (err) {
-    throw new Error(`You must provide 'account' in COZY_FIELDS: ${err.message}`)
-  }
-}
-
-module.exports = { getAccountId }
-
-
 /***/ })
 /******/ 	]);
 /************************************************************************/
-- 
GitLab