<commit_before>import path from 'path'
import _ from 'lodash'
import fs from 'fs-extra'
import logger from 'winston'
import core, { initializeElements } from 'weacast-core'
import probe from 'weacast-probe'
import alert from 'weacast-alert'

const modelPath = path.join(__dirname, 'models')
const servicePath = path.join(__dirname, 'services')

module.exports = async function () {
  const app = this
  const authConfig = app.get('authentication')
  // Setup app services
  try {
    if (authConfig) app.createService('users', modelPath, servicePath)
    app.configure(core)
    // Setup if we use local loaders
    const loaders = app.get('loaders')
    if (loaders && loaders.length > 0) {
      // Setup loader plugins by dynamically require them
      loaders.forEach(loader => {
        const plugin = require(`weacast-${loader}`)
        app.configure(plugin)
      })
    } else { 
      // Set up only elements services otherwise
      const forecasts = app.get('forecasts')
      // Iterate over configured forecast models
      for (let i = 0; i < forecasts.length; i++) {
        await initializeElements(app, forecasts[i])
      }
    }
    app.configure(probe)
    app.configure(alert)
  }<commit_msg>Fixed code after initializePlugin has been made async<commit_after>import path from 'path'
import _ from 'lodash'
import fs from 'fs-extra'
import logger from 'winston'
import core, { initializeElements } from 'weacast-core'
import probe from 'weacast-probe'
import alert from 'weacast-alert'

const modelPath = path.join(__dirname, 'models')
const servicePath = path.join(__dirname, 'services')

module.exports = async function () {
  const app = this
  const authConfig = app.get('authentication')
  // Setup app services
  try {
    if (authConfig) app.createService('users', modelPath, servicePath)
    app.configure(core)
    // Setup if we use local loaders
    const loaders = app.get('loaders')
    if (loaders && loaders.length > 0) {
      // Iterate over configured loaders
      for (let i = 0; i < loaders.length; i++) {
        // Setup loader plugins by dynamically require them
        const plugin = require(`weacast-${loaders[i]}`)
        await app.configure(plugin)
      }
    } else { 
      // Set up only elements services otherwise
      const forecasts = app.get('forecasts')
      // Iterate over configured forecast models
      for (let i = 0; i < forecasts.length; i++) {
        await initializeElements(app, forecasts[i])
      }
    }
    app.configure(probe)
    app.configure(alert)
  }
{'fraction_non_alphanumeric': 0.11124260355029586, 'fraction_numerical': 0.0019723865877712033, 'mean_word_length': 3.1642036124794743, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '3294676', 'n_tokens_mistral': 746, 'n_tokens_neox': 726, 'n_words': 232}