<commit_before>#!/usr/bin/env node
'use strict';

var express   = require('express'),
    Developer = require('./developer.js'),
    Iam       = require('./iam.js'),
    Sessions  = require('./sessions.js');


var app = express();

function generateResponse(key){
    return {
        Code: 'Success',
        LastUpdated: new Date().toISOString(),
        Type: 'AWS-HMAC',
        AccessKeyId: key.accessKey,
        SecretAccessKey: key.secretKey,
        Token: key.sessionToken,
        Expiration: new Date(key.expires).toISOString(),
        ALKSIsIAM: key.isIAM,
        ALKSAccount: key.alksAccount,
        ALKSRole: key.alksRole
    };
}

app.get('/latest/dynamic/instance-identity/document', function(req, resp){
   resp.end(JSON.stringify({
       region: 'us-east-1'
   }));
});

app.get('/latest/meta-data/iam/security-credentials*', (req, resp) => {
    resp.end('alks');
});

app.get('/latest/meta-data/*', function(req, resp){
    Developer.getMetadata(function(err, metadata){
        if(metadata.isIAM){
            Iam.getIAMKey({}, null, metadata.alksAccount, metadata.alksRole, false, false, function(err, key){<commit_msg>Fix urls in metadata server to conform to AWS SDK expectations<commit_after>#!/usr/bin/env node
'use strict';

var express   = require('express'),
    Developer = require('./developer.js'),
    Iam       = require('./iam.js'),
    Sessions  = require('./sessions.js');


var app = express();

function generateResponse(key){
    return {
        Code: 'Success',
        LastUpdated: new Date().toISOString(),
        Type: 'AWS-HMAC',
        AccessKeyId: key.accessKey,
        SecretAccessKey: key.secretKey,
        Token: key.sessionToken,
        Expiration: new Date(key.expires).toISOString(),
        ALKSIsIAM: key.isIAM,
        ALKSAccount: key.alksAccount,
        ALKSRole: key.alksRole
    };
}

app.get('/latest/dynamic/instance-identity/document', function(req, resp){
   resp.end(JSON.stringify({
       region: 'us-east-1'
   }));
});

app.get(['/latest/meta-data/iam/security-credentials', '/latest/meta-data/iam/security-credentials'], (req, resp) => {
    resp.end('alks');
});

app.get('/latest/meta-data/iam/security-credentials/*', function(req, resp){
    Developer.getMetadata(function(err, metadata){
        if(metadata.isIAM){
            Iam.getIAMKey({}, null, metadata.alksAccount, metadata.alksRole, false, false, function(err, key){
{'fraction_non_alphanumeric': 0.1661831744716121, 'fraction_numerical': 0.0008288437629506838, 'mean_word_length': 3.098471986417657, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3588107', 'n_tokens_mistral': 786, 'n_tokens_neox': 764, 'n_words': 140}