<commit_before>"use strict";

const network = require('../system/network');
const routes = require('./routes');

module.exports = function(server, interfaces, httpLogs) {

  if (!interfaces) {
    interfaces = [];
    if (server.conf) {
      interfaces = [{
        ip: server.conf.ipv4,
        port: server.conf.port
      }];
      if (server.conf.ipv6) {
        interfaces.push({
          ip: server.conf.ipv6,
          port: server.conf.port
        });
      }
    }
  }

  return network.createServersAndListen('Duniter server', interfaces, httpLogs, null, (app, httpMethods) => {
    
    routes.bma(server, '', app, httpMethods);

  }, routes.bmaWS(server, ''));
};
<commit_msg>Fix #688 Crash on startup if only IPv6 is enabled<commit_after>"use strict";

const network = require('../system/network');
const routes = require('./routes');

module.exports = function(server, interfaces, httpLogs) {

  if (!interfaces) {
    interfaces = [];
    if (server.conf) {
      if (server.conf.ipv4) {
        interfaces = [{
          ip: server.conf.ipv4,
          port: server.conf.port
        }];
      }
      if (server.conf.ipv6) {
        interfaces.push({
          ip: server.conf.ipv6,
          port: server.conf.port
        });
      }
    }
  }

  return network.createServersAndListen('Duniter server', interfaces, httpLogs, null, (app, httpMethods) => {
    
    routes.bma(server, '', app, httpMethods);

  }, routes.bmaWS(server, ''));
};

{'fraction_non_alphanumeric': 0.15778688524590165, 'fraction_numerical': 0.007513661202185792, 'mean_word_length': 2.4389671361502345, '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': '2604656', 'n_tokens_mistral': 475, 'n_tokens_neox': 470, 'n_words': 93}