<commit_before>'use strict';

var app = require('connect')();
var http = require('http');
var swaggerTools = require('swagger-tools');
var jsyaml = require('js-yaml');
var fs = require('fs');
var serverPort = 8080;
var config = require('config');
var jwt    = require('jsonwebtoken');

// swaggerRouter configuration
var options = {
  swaggerUi: '/swagger.json',
  controllers: './controllers',
  useStubs: process.env.NODE_ENV === 'development' ? true : false // Conditionally turn on stubs (mock mode)
}
var security_options = {
    api_key: function (req, authOrSecDef, scopesOrApiKey, cb) {
      try {
        console.log(req.headers);
        var decoded = jwt.verify(req.headers.api_key, config.secret);
        if (decoded) {
          req.swagger.params.user_data = decoded;
          cb();
        } else {
          cb(new Error('access denied!'));
        }
      } catch (err) {
        cb(new Error('access denied! - ' + err));
      }
    }
};<commit_msg>more debugging to track this kubernetes header thing. api_key is being smashed in the header<commit_after>'use strict';

var app = require('connect')();
var http = require('http');
var swaggerTools = require('swagger-tools');
var jsyaml = require('js-yaml');
var fs = require('fs');
var serverPort = 8080;
var config = require('config');
var jwt    = require('jsonwebtoken');

// swaggerRouter configuration
var options = {
  swaggerUi: '/swagger.json',
  controllers: './controllers',
  useStubs: process.env.NODE_ENV === 'development' ? true : false // Conditionally turn on stubs (mock mode)
}
var security_options = {
    api_key: function (req, authOrSecDef, scopesOrApiKey, cb) {
      try {
        console.log('scopes ' + scopesOrApiKey);
        console.log(req.headers);
        var decoded = jwt.verify(req.headers.api_key, config.secret);
        if (decoded) {
          req.swagger.params.user_data = decoded;
          cb();
        } else {
          cb(new Error('access denied!'));
        }
      } catch (err) {
        cb(new Error('access denied! - ' + err));
      }
    }
};
{'fraction_non_alphanumeric': 0.14796905222437137, 'fraction_numerical': 0.0038684719535783366, 'mean_word_length': 3.001934235976789, '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': '7597673', 'n_tokens_mistral': 653, 'n_tokens_neox': 638, 'n_words': 164}