<commit_before>const SSDP = require('node-ssdp').Server
const LISTEN_INTERFACE = process.env.LISTEN_INTERFACE || 'eth0'
const SERVER_SETTINGS = require('js-yaml')
                        .safeLoad(require('fs')
                        .readFileSync(process.env.SETTINGS_FILE, 'utf8'))
                        .server || {}
const SSDP_SETTINGS = require('js-yaml')
                      .safeLoad(require('fs')
                      .readFileSync(process.env.SETTINGS_FILE, 'utf8'))
                      .ssdp || {}
const USN = SSDP_SETTINGS.usn || 'uuid:c3c3c35a-4216-4079-84ae-e6d306ff9d7b'
const UDN = `${SSDP_SETTINGS.udn_prefix || 'urn:schemas-upnp-org:service:ISYDeviceManager'}:${SERVER_SETTINGS.instance_number || 1}`

module.exports = (sails) => {
  var server
  var advertiseIP
  var advertisePort

  return {
    advertiseIP: function () {
      return advertiseIP
    },

    advertisePort: function () {
      return advertisePort
    },

    configure: () => {
    },

    defaults: {
       __configKey__: {
          _hookTimeout: 30000
       }
    },

    initialize: (cb) => {
      sails.after('hook:device_update:loaded', () => {
        advertiseIP = process.env.DEVICE_ADVERTISE_IP
        if (advertiseIP === undefined) {
          advertiseIP = require('ip').address()
          var ifaces = require('os').networkInterfaces()
          Object.keys(ifaces).forEach(dev => {<commit_msg>Fixed USN UDN<commit_after>const SSDP = require('node-ssdp').Server
const LISTEN_INTERFACE = process.env.LISTEN_INTERFACE || 'eth0'
const SERVER_SETTINGS = require('js-yaml')
                        .safeLoad(require('fs')
                        .readFileSync(process.env.SETTINGS_FILE, 'utf8'))
                        .server || {}
const SSDP_SETTINGS = require('js-yaml')
                      .safeLoad(require('fs')
                      .readFileSync(process.env.SETTINGS_FILE, 'utf8'))
                      .ssdp || {}
const USN = `${SSDP_SETTINGS.usn_prefix || 'urn:schemas-upnp-org:service:ISYDeviceManager'}:${SERVER_SETTINGS.instance_number || 1}`
const UDN = SSDP_SETTINGS.udn || 'uuid:c3c3c35a-4216-4079-84ae-e6d306ff9d7b'

module.exports = (sails) => {
  var server
  var advertiseIP
  var advertisePort

  return {
    advertiseIP: function () {
      return advertiseIP
    },

    advertisePort: function () {
      return advertisePort
    },

    configure: () => {
    },

    defaults: {
       __configKey__: {
          _hookTimeout: 30000
       }
    },

    initialize: (cb) => {
      sails.after('hook:device_update:loaded', () => {
        advertiseIP = process.env.DEVICE_ADVERTISE_IP
        if (advertiseIP === undefined) {
          advertiseIP = require('ip').address()
          var ifaces = require('os').networkInterfaces()
          Object.keys(ifaces).forEach(dev => {
{'fraction_non_alphanumeric': 0.13484740951029098, 'fraction_numerical': 0.0205819730305181, 'mean_word_length': 2.3599523241954707, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2081442', 'n_tokens_mistral': 935, 'n_tokens_neox': 894, 'n_words': 134}