Skip to content
Snippets Groups Projects
Commit 10a68619 authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

edit local conf for onDelete

parent 56459d1c
No related branches found
No related tags found
1 merge request!19Feat/us858 save expiration date
Pipeline #42584 failed
......@@ -10,8 +10,11 @@ function isLocal() {
* Verify if it's an alpha URL
* @returns {boolean}
*/
function isAlpha() {
return process.env.COZY_URL.includes('alpha')
function isDev() {
return (
process.env.COZY_URL.includes('alpha') ||
process.env.COZY_URL.includes('cozy.tools')
)
}
module.exports = { isLocal, isAlpha }
module.exports = { isLocal, isDev }
......@@ -12,8 +12,7 @@ const moment = require('moment')
require('moment-timezone')
moment.locale('fr') // set the language
moment.tz.setDefault('Europe/Paris') // set the timezone
const { isLocal, isAlpha } = require('./helpers/env')
// const ACCOUNT_ID = isLocal() ? 'default_account_id' : 'enedis-sge-grandlyon'
const { isLocal, isDev } = require('./helpers/env')
async function onDeleteAccount() {
log('info', 'Deleting account ...')
......@@ -36,13 +35,14 @@ async function onDeleteAccount() {
})
}
const secrets = getAccountSecret()
log('warn', `Account DATAA InOndelete ${JSON.stringify(accountData)}`)
const userConsent = await getBoConsent(
secrets.boBaseUrl,
secrets.boToken,
accountData.data.consentId
)
log('info', `isAlpha: ${isAlpha()}`)
log('info', `isAlpha: ${isDev()}`)
log('info', `userConsent: ${JSON.stringify(userConsent)}`)
if (userConsent.ID && userConsent.pointID) {
log('log', `Consent ${userConsent.ID} found for user`)
......@@ -53,7 +53,7 @@ async function onDeleteAccount() {
userConsent.ID
)
// Verify if it's dev env to prevent delete of real data
if (!isAlpha()) {
if (!isDev()) {
await terminateContract(
secrets.wso2BaseUrl,
secrets.apiToken,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment