<commit_before>const axios = require('axios')
const _ = require('lodash/fp')
const uuid = require('uuid')

const sendMessage = (settings, rec) => {
  const webhookUrl = process.env.WEBHOOK_URL

  if (_.isEmpty(webhookUrl)) return Promise.resolve()

  const body = _.merge(rec.webhook, { id: uuid.v4() })

  return axios({
    method: 'POST',
    url: webhookUrl,
    data: body
  })
}

module.exports = {
  sendMessage
}<commit_msg>fix: move environment variable read to only happen once<commit_after>const axios = require('axios')
const _ = require('lodash/fp')
const uuid = require('uuid')

const WEBHOOK_URL = process.env.WEBHOOK_URL

const sendMessage = (settings, rec) => {
  if (_.isEmpty(WEBHOOK_URL)) return Promise.resolve()

  const body = _.merge(rec.webhook, { id: uuid.v4() })

  return axios({
    method: 'POST',
    url: WEBHOOK_URL,
    data: body
  })
}

module.exports = {
  sendMessage
}
{'fraction_non_alphanumeric': 0.1444321940463065, 'fraction_numerical': 0.002205071664829107, 'mean_word_length': 4.016574585635359, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4367290', 'n_tokens_mistral': 322, 'n_tokens_neox': 312, 'n_words': 76}