<commit_before>'use strict'

const Chairo = require('chairo')
const Seneca = require('seneca')()
const Hapi = require('hapi')
const Hoek = require('hoek')
const hapiAuthCookie = require('hapi-auth-cookie')
const hapiAuthJwt2 = require('hapi-auth-jwt2')
const server = new Hapi.Server()
const config = require('./config')
const skoleskyssService = require('./index')
const validate = require('./lib/validate-jwt')
const validateAPI = require('./lib/validate-api')
const goodOptions = {
  ops: {
    interval: 900000
  },
  reporters: {
    console: [{
      module: 'good-squeeze',
      name: 'Squeeze',
      args: [{ log: '*', ops: '*', error: '*' }]
    }, {
      module: 'good-console'
    }, 'stdout']
  }
}
const yarOptions = {
  storeBlank: false,
  cookieOptions: {
    password: <PASSWORD>,
    isSecure: true
  }
}

const authPlugins = [
  {
    register: hapiAuthCookie,
    options: {}
  },
  {
    register: hapiAuthJwt2,
    options: {}
  }
]

const plugins = [
  {register: Chairo, options: {seneca: Seneca}}
]

function endIfError (error) {
  if (error) {
    console.error(error)
    process.exit(1)
  }
}

server.register(plugins, function (error) {
  endIfError(error)
})

server.connection({
  port: config.SKOLESKYSS_SERVER_PORT_WEB
})

server.register(authPlugins, function (error) {
  endIfError(error)

  server.auth.strategy('session', 'cookie', {
    password: <PASSWORD>,
    cookie: 'skoleskyss-session',
    validateFunc: validate,
    redirectTo: config.SKOLESKYSS_AUTH_URL_LOGIN,
    isSecure: false
  })

  server.auth.default('session')

  server.auth.strategy('jwt', 'jwt', {
    key: config.SKOLESKYSS_JWT_SECRET,          // Never Share your secret key<commit_msg>isSecure = true to fix redirect loop<commit_after>'use strict'

const Chairo = require('chairo')
const Seneca = require('seneca')()
const Hapi = require('hapi')
const Hoek = require('hoek')
const hapiAuthCookie = require('hapi-auth-cookie')
const hapiAuthJwt2 = require('hapi-auth-jwt2')
const server = new Hapi.Server()
const config = require('./config')
const skoleskyssService = require('./index')
const validate = require('./lib/validate-jwt')
const validateAPI = require('./lib/validate-api')
const goodOptions = {
  ops: {
    interval: 900000
  },
  reporters: {
    console: [{
      module: 'good-squeeze',
      name: 'Squeeze',
      args: [{ log: '*', ops: '*', error: '*' }]
    }, {
      module: 'good-console'
    }, 'stdout']
  }
}
const yarOptions = {
  storeBlank: false,
  cookieOptions: {
    password: <PASSWORD>,
    isSecure: true
  }
}

const authPlugins = [
  {
    register: hapiAuthCookie,
    options: {}
  },
  {
    register: hapiAuthJwt2,
    options: {}
  }
]

const plugins = [
  {register: Chairo, options: {seneca: Seneca}}
]

function endIfError (error) {
  if (error) {
    console.error(error)
    process.exit(1)
  }
}

server.register(plugins, function (error) {
  endIfError(error)
})

server.connection({
  port: config.SKOLESKYSS_SERVER_PORT_WEB
})

server.register(authPlugins, function (error) {
  endIfError(error)

  server.auth.strategy('session', 'cookie', {
    password: config.SK<PASSWORD>_COOKIE_SECRET,
    cookie: 'skoleskyss-session',
    validateFunc: validate,
    redirectTo: config.SKOLESKYSS_AUTH_URL_LOGIN,
    isSecure: true
  })

  server.auth.default('session')

  server.auth.strategy('jwt', 'jwt', {
    key: config.SKOLESKYSS_JWT_SECRET,          // Never Share your secret key
{'fraction_non_alphanumeric': 0.1514360313315927, 'fraction_numerical': 0.005802146794313896, 'mean_word_length': 3.6594594594594594, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5464960', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1204, 'n_words': 240}