<commit_before>#!/bin/sh

if [ "$CONSUL_ENABLED" = "true" ]; then
  ipaddress="$(ifconfig eth0 | grep 'inet addr' | cut -d ':' -f 2 | cut -d ' ' -f 1)"
  CONSUL_HOSTNAME="${CONSUL_HOSTNAME:-consul}"
  CONSUL_PORT="${CONSUL_PORT:-8500}"

  cat <<SERVICEDEF > /puppet-service.json
{
  "name": "puppetdb",
  "id": "$HOSTNAME",
  "port": 8080,
  "address": "$ipaddress",
  "checks": [
    {
      "http": "http://$HOSTNAME:8080/status/v1/services/puppetdb-status",
      "interval": "30s",
      "deregister_critical_service_after": "10m"
    }
  ]
}
SERVICEDEF

  curl \
    --request PUT \
    --data @puppet-service.json \
    http://$CONSUL_HOSTNAME:$CONSUL_PORT/v1/agent/service/register
fi<commit_msg>(maint) If consul is enabled, run the http healthcheck every 10 seconds<commit_after>#!/bin/sh

if [ "$CONSUL_ENABLED" = "true" ]; then
  ipaddress="$(ifconfig eth0 | grep 'inet addr' | cut -d ':' -f 2 | cut -d ' ' -f 1)"
  CONSUL_HOSTNAME="${CONSUL_HOSTNAME:-consul}"
  CONSUL_PORT="${CONSUL_PORT:-8500}"

  cat <<SERVICEDEF > /puppet-service.json
{
  "name": "puppetdb",
  "id": "$HOSTNAME",
  "port": 8080,
  "address": "$ipaddress",
  "checks": [
    {
      "http": "http://$HOSTNAME:8080/status/v1/services/puppetdb-status",
      "interval": "10s",
      "deregister_critical_service_after": "10m"
    }
  ]
}
SERVICEDEF

  curl \
    --request PUT \
    --data @puppet-service.json \
    http://$CONSUL_HOSTNAME:$CONSUL_PORT/v1/agent/service/register
fi
{'fraction_non_alphanumeric': 0.19057377049180327, 'fraction_numerical': 0.030054644808743168, 'mean_word_length': 3.4126506024096384, 'pattern_counts': {'":': 16, '<': 7, '<?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': '2395112', 'n_tokens_mistral': 619, 'n_tokens_neox': 585, 'n_words': 102}