<commit_before>var aws = require('aws-sdk');
var winston = module.parent.require('winston');
var meta = module.parent.require('./meta');
var Emailer = {};
var ses;
var fromAddress;

Emailer.init = function(params, callback){
    function render(req, res, next){
        res.render('admin/plugins/emailer-ses', {});
    }
    
    meta.settings.get('emailer-ses', function(err, settings) {
        if(!err && settings && settings.accessKeyID && settings.secretAccessKey && settings.region && settings.fromAddress) {
            var creds = new aws.Credentials(settings.accessKeyID, settings.secretAccessKey, null);
            ses = new aws.SES({credentials: creds, region: settings.region, apiVersion: '2010-12-01'});
            fromAddress = settings.fromAddress;
        } else {<commit_msg>Added support for IAM users (#2)<commit_after>var aws = require('aws-sdk');
var winston = module.parent.require('winston');
var meta = module.parent.require('./meta');
var Emailer = {};
var ses;
var fromAddress;

Emailer.init = function(params, callback){
    function render(req, res, next){
        res.render('admin/plugins/emailer-ses', {});
    }
    
    meta.settings.get('emailer-ses', function(err, settings) {
        if(!err && settings && settings.region && settings.fromAddress) {
            var creds,
                iam = new aws.IAM();

            if (settings.accessKeyID && settings.secretAccessKey){
                creds = new aws.Credentials(settings.accessKeyID, settings.secretAccessKey, null);
                ses = new aws.SES({credentials: creds, region: settings.region, apiVersion: '2010-12-01'});
                fromAddress = settings.fromAddress;
            }else {
                ses = new aws.SES({region: settings.region, apiVersion: '2010-12-01'});
                fromAddress = settings.fromAddress;
            }
        } else {
{'fraction_non_alphanumeric': 0.14316353887399463, 'fraction_numerical': 0.013404825737265416, 'mean_word_length': 2.8474226804123712, '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': '711405', 'n_tokens_mistral': 553, 'n_tokens_neox': 534, 'n_words': 117}