<commit_before><?php

// Nymph's configuration.
$nymphConfig = [];
// Check for production postgres var.
if (getenv('NYMPH_PRODUCTION')) {
  $dbopts = parse_url(getenv('DATABASE_URL'));
  $nymphConfig['driver'] = 'PostgreSQL';
  $nymphConfig['PostgreSQL'] = [
    'database' => ltrim($dbopts["path"], '/'),
    'host' => $dbopts["host"],
    'port' => $dbopts["port"],
    'user' => $dbopts["user"],
    'password' => $dbopts["pass"]
  ];
} elseif (getenv('MYSQL_HOST')) {
  $nymphConfig['MySQL'] = [
    'host' => getenv('MYSQL_HOST'),
    'database' => getenv('MYSQL_DATABASE'),
    'user' => getenv('MYSQL_USER'),
    'password' => getenv('<PASSWORD>')
  ];
} else {
  if (getenv('DB') === 'pgsql') {
    $nymphConfig['driver'] = 'PostgreSQL';
    $nymphConfig['PostgreSQL'] = [
      'host' => '127.0.0.1',
      'database' => 'nymph_example',
      'user' => 'nymph_example',
      'password' => '<PASSWORD>'
    ];
  } else {
    $nymphConfig['MySQL'] = [
      'host' => '127.0.0.1',
      'database' => 'nymph_example',
      'user' => 'nymph_example',
      'password' => '<PASSWORD>'
    ];
  }
}
\Nymph\Nymph::configure($nymphConfig);

// Nymph PubSub's configuration.
if (getenv('NYMPH_PRODUCTION')) {
  // If we're on Heroku, the entry is the pubsub demo.
  $entry = 'wss://nymph-pubsub-demo.herokuapp.com:443/';
} elseif (getenv('PUBSUB_HOST')) {
  // If we're in Docker, the entry is provided by Docker.
  $entry = 'ws://'.getenv('PUBSUB_HOST').'/';
} else {
  // If we're not in either, it's probaby on the same host.
  $entry = 'ws://localhost:8081/';<commit_msg>Support Postgres in examples in dev environment.<commit_after><?php

// Nymph's configuration.
$nymphConfig = [];
// Check for production postgres var.
if (getenv('NYMPH_PRODUCTION')) {
  $dbopts = parse_url(getenv('DATABASE_URL'));
  $nymphConfig['driver'] = 'PostgreSQL';
  $nymphConfig['PostgreSQL'] = [
    'database' => ltrim($dbopts["path"], '/'),
    'host' => $dbopts["host"],
    'port' => $dbopts["port"],
    'user' => $dbopts["user"],
    'password' => $dbopts["pass"]
  ];
} elseif (getenv('MYSQL_HOST')) {
  $nymphConfig['MySQL'] = [
    'host' => getenv('MYSQL_HOST'),
    'database' => getenv('MYSQL_DATABASE'),
    'user' => getenv('MYSQL_USER'),
    'password' => getenv('<PASSWORD>')
  ];
} elseif (getenv('PGSQL_HOST')) {
  $nymphConfig['driver'] = 'PostgreSQL';
  $nymphConfig['PostgreSQL'] = [
    'host' => getenv('PGSQL_HOST'),
    'port' => getenv('PGSQL_PORT'),
    'database' => getenv('PGSQL_DATABASE'),
    'user' => getenv('PGSQL_USER'),
    'password' => getenv('<PASSWORD>')
  ];
} else {
  if (getenv('DB') === 'pgsql') {
    $nymphConfig['driver'] = 'PostgreSQL';
    $nymphConfig['PostgreSQL'] = [
      'host' => '127.0.0.1',
      'database' => 'nymph_example',
      'user' => 'nymph_example',
      'password' => '<PASSWORD>'
    ];
  } else {
    $nymphConfig['MySQL'] = [
      'host' => '127.0.0.1',
      'database' => 'nymph_example',
      'user' => 'nymph_example',
      'password' => '<PASSWORD>'
    ];
  }
}
\Nymph\Nymph::configure($nymphConfig);

// Nymph PubSub's configuration.
if (getenv('NYMPH_PRODUCTION')) {
  // If we're on Heroku, the entry is the pubsub demo.
  $entry = 'wss://nymph-pubsub-demo.herokuapp.com:443/';
} elseif (getenv('PUBSUB_HOST')) {
  // If we're in Docker, the entry is provided by Docker.
  $entry = 'ws://'.getenv('PUBSUB_HOST').'/';
} else {
  // If we're not in either, it's probaby on the same host.
  $entry = 'ws://localhost:8081/';
{'fraction_non_alphanumeric': 0.22377822234924263, 'fraction_numerical': 0.010860245784509859, 'mean_word_length': 3.6666666666666665, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '7444052', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1329, 'n_words': 236}