<commit_before>/**
 * Restarts the server after updates
 */
orion.config.collection.after.update(function (userId, doc, fieldNames, modifier, options) {
  // Timeout is necessary to no enter a infinit loop of restarts
  Meteor.setTimeout(function () {
    console.log('Updating Orion config');
    process.exit();
  }, 500);
});

/**
 * Creates one object in the config collection
 */
if (orion.config.collection.find().count() === 0) {
  orion.config.collection.insert({}, function(){
    console.log("Orion config initialized")
  });
}

/**
 * Publications of the config. Only for admins
 */
Meteor.publish(null, function() {
  if (!this.userId) {
    return [];
  }
  if (Roles.userHasPermission(this.userId, 'config.update')) {
    return orion.config.collection.find();
  }
}, { is_auto: true });

/**
 * Get the config from the database only once
 */
orion.config.object = orion.config.collection.findOne();

/**
 * Send the data to the client (only public values).
 * It uses the injection method (meteorhacks:inject-initial) not 
 * the publish/subcribe, because this is not meant to be reactive 
 * and the values should be on the client when it starts.
 */
Meteor.startup(function () {
  if (orion.config.getPublicFields()) {
    Inject.obj('orion.config', {});<commit_msg>Fixed bug causing public settings not being sent to client.<commit_after>/**
 * Restarts the server after updates
 */
orion.config.collection.after.update(function (userId, doc, fieldNames, modifier, options) {
  // Timeout is necessary to no enter a infinit loop of restarts
  Meteor.setTimeout(function () {
    console.log('Updating Orion config');
    process.exit();
  }, 500);
});

/**
 * Creates one object in the config collection
 */
if (orion.config.collection.find().count() === 0) {
  orion.config.collection.insert({}, function(){
    console.log("Orion config initialized")
  });
}

/**
 * Publications of the config. Only for admins
 */
Meteor.publish(null, function() {
  if (!this.userId) {
    return [];
  }
  if (Roles.userHasPermission(this.userId, 'config.update')) {
    return orion.config.collection.find();
  }
}, { is_auto: true });

/**
 * Get the config from the database only once
 */
orion.config.object = orion.config.collection.findOne();

/**
 * Send the data to the client (only public values).
 * It uses the injection method (meteorhacks:inject-initial) not 
 * the publish/subcribe, because this is not meant to be reactive 
 * and the values should be on the client when it starts.
 */
Meteor.startup(function () {
  if (!orion.config.getPublicFields()) {
    Inject.obj('orion.config', {});
{'fraction_non_alphanumeric': 0.14389590508993494, 'fraction_numerical': 0.0030616150019135095, 'mean_word_length': 3.7963302752293577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4717288', 'n_tokens_mistral': 808, 'n_tokens_neox': 785, 'n_words': 237}