Commit 258e5ded authored by Michael Henretty's avatar Michael Henretty Committed by GitHub
Browse files

Merge pull request #109 from gozer/issue/108/http-proxies

Use outbound proxy for HTTP calls when present
parents 627f7180 51e14de9
var AWS = require('aws-sdk');
if(process.env.HTTP_PROXY) {
var proxy = require('proxy-agent');
AWS.config.update({
httpOptions: { agent: proxy(process.env.HTTP_PROXY) }
});
}
module.exports = AWS;
import * as http from 'http';
import Files from './files';
import { getFileExt } from './utility';
import S3 = require('aws-sdk/clients/s3');
const ms = require('mediaserver');
const path = require('path');
......@@ -11,6 +10,7 @@ const crypto = require('crypto');
const Promise = require('bluebird');
const mkdirp = require('mkdirp');
const findRemoveSync = require('find-remove');
const AWS = require('./aws');
const UPLOAD_PATH = path.resolve(__dirname, '../..', 'upload');
const CONFIG_PATH = path.resolve(__dirname, '../../..', 'config.json');
......@@ -24,11 +24,11 @@ const BUCKET_NAME = config.BUCKET_NAME || 'common-voice-corpus';
* Clip - Responsibly for saving and serving clips.
*/
export default class Clip {
private s3: S3;
private s3: any;
private files: Files;
constructor() {
this.s3 = new S3();
this.s3 = new AWS.S3();
this.files = new Files();
setInterval(findRemoveSync.bind(this, UPLOAD_PATH, {age: {seconds: 300}, extensions: '.mp3'}), 300);
}
......
import { map } from '../promisify';
import { getFileExt } from './utility';
import S3 = require('aws-sdk/clients/s3');
const MemoryStream = require('memorystream');
const path = require('path');
const Promise = require('bluebird');
const Queue = require('better-queue');
const sox = require('sox-stream');
const AWS = require('./aws');
const BATCH_SIZE = 5;
const MP3_EXT = '.mp3';
......@@ -17,7 +17,7 @@ const BUCKET_NAME = config.BUCKET_NAME || 'common-voice-corpus';
export default class Files {
private initialized: boolean;
private s3: S3;
private s3: any;
private files: {
// fileGlob: [
// sentence: 'the text of the sentenct',
......@@ -29,7 +29,7 @@ export default class Files {
constructor() {
this.initialized = false;
this.s3 = new S3();
this.s3 = new AWS.S3();
this.files = {};
this.paths = [];
this.mp3s = [];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment