<commit_before>var fs = require('fs');
var path = require('path');
var express = require('express');
var router = express.Router();

var passport = require('passport')
var OAuthStrategy = require('passport-oauth').OAuthStrategy;

var accessfile = path.join (__dirname, 'twitterapi.json');
var twitteraccess = JSON.parse(fs.readFileSync(accessfile, 'utf8'));

passport.use('twitter', new OAuthStrategy({
    //authorizationURL: 'https://www.provider.com/oauth2/authorize',
    userAuthorizationURL: 'https://api.twitter.com/oauth/authorize',
    requestTokenURL: 'https://api.twitter.com/oauth/request_token',
    accessTokenURL: 'https://api.twitter.com/oauth/access_token',
    callbackURL: twitteraccess.callbackURL,
    consumerKey: twitteraccess.key,
    consumerSecret: twitteraccess.keySecret
  },

  function(token, tokenSecret, profile, done) {<commit_msg>environment variables<commit_after>var fs = require('fs');
var path = require('path');
var express = require('express');
var router = express.Router();

var passport = require('passport')
var OAuthStrategy = require('passport-oauth').OAuthStrategy;

var twitteraccess;

try {
  var accessfile = path.join (__dirname, 'twitterapi.json');
  twitteraccess = JSON.parse(fs.readFileSync(accessfile, 'utf8'));
} catch (err) {
  twitteraccess = {
    key: process.env.FERRET_KEY,
    keySecret: process.env.FERRET_KEY_SECRET,
    token: process.env.FERRET_TOKEN,
    tokenSecret: process.env.FERRET_TOKEN_SECRET,
    callbackURL: (process.env.FERRET_HOST || "http://localhost:3000") 
    + "/auth/twitter/callback"
  }
}

passport.use('twitter', new OAuthStrategy({
    //authorizationURL: 'https://www.provider.com/oauth2/authorize',
    userAuthorizationURL: 'https://api.twitter.com/oauth/authorize',
    requestTokenURL: 'https://api.twitter.com/oauth/request_token',
    accessTokenURL: 'https://api.twitter.com/oauth/access_token',
    callbackURL: twitteraccess.callbackURL,
    consumerKey: twitteraccess.key,
    consumerSecret: twitteraccess.keySecret
  },

  function(token, tokenSecret, profile, done) {
{'fraction_non_alphanumeric': 0.14527027027027026, 'fraction_numerical': 0.003861003861003861, 'mean_word_length': 5.1513353115727005, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, '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': '2918290', 'n_tokens_mistral': 656, 'n_tokens_neox': 641, 'n_words': 114}