<commit_before>const app = require('express')();
const partials = require('express-partials');
const serveStatic = require('serve-static');
const bodyParser = require('body-parser');
const path = require('path');
const stormpath = require('express-stormpath');

const db = require('./helper.js');
const credential = require('./credential.js');

app.use(stormpath.init(app, {
  web: {
    login: {enabled: true},
    register: {enabled: true},
    logout: {enabled: true}
  },
  apiKey: {
    id: credential.stormpath.id,
    secret: credential.stormpath.secret
  },
  application: {
    href: credential.stormpath.href
  }
}));

app.use(partials());
app.use(bodyParser.json());
app.use(serveStatic(__dirname + '/../build'));

// Constants
const PORT = process.env.PORT || 8128;

app.post('/email', (req, res) => {
  // console.log(req.body);
  db.email.addEmail(req.body.email);
  res.status(201).json(req.body);
  res.end();
});

app.get('*', (req, res) => {
  res.sendFile(path.join(__dirname, '../build/index.html'));
});

app.on('stormpath.ready', () => {
  const server = app.listen(PORT, () => {
    console.log('Running on http://localhost:' + PORT);
  });
});

<commit_msg>(chore) Add environment variables to server.js<commit_after>const app = require('express')();
const partials = require('express-partials');
const serveStatic = require('serve-static');
const bodyParser = require('body-parser');
const path = require('path');
const stormpath = require('express-stormpath');

const db = require('./helper.js');
let credential;

if (process.env.STORMPATH_CLIENT_APIKEY_ID) {
  credential = {
    stormpath: {
      id: process.env.STORMPATH_CLIENT_APIKEY_ID,
      secret: process.env.STORMPATH_CLIENT_APIKEY_SECRET,
      href: process.env.STORMPATH_APPLICATION_HREF
    }
  };
} else {
  credential = require('./credential.js');
}

app.use(stormpath.init(app, {
  web: {
    login: {enabled: true},
    register: {enabled: true},
    logout: {enabled: true}
  },
  apiKey: {
    id: credential.stormpath.id,
    secret: credential.stormpath.secret
  },
  application: {
    href: credential.stormpath.href
  }
}));

app.use(partials());
app.use(bodyParser.json());
app.use(serveStatic(__dirname + '/../build'));

// Constants
const PORT = process.env.PORT || 8128;

app.post('/email', (req, res) => {
  // console.log(req.body);
  db.email.addEmail(req.body.email);
  res.status(201).json(req.body);
  res.end();
});

app.get('*', (req, res) => {
  res.sendFile(path.join(__dirname, '../build/index.html'));
});

app.on('stormpath.ready', () => {
  const server = app.listen(PORT, () => {
    console.log('Running on http://localhost:' + PORT);
  });
});


{'fraction_non_alphanumeric': 0.19857624578493818, 'fraction_numerical': 0.005245410266017235, 'mean_word_length': 4.066413662239089, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3257341', 'n_tokens_mistral': 927, 'n_tokens_neox': 917, 'n_words': 161}