update script to migrate assets to cdn url

This commit is contained in:
Cassie Tarakajian 2018-01-09 16:12:02 -05:00
parent fb1684ce4b
commit 81f7c53a1b
2 changed files with 3 additions and 3 deletions

View file

@ -39,8 +39,8 @@ Project.count({})
async.eachSeries(projects, (project, cb) => { async.eachSeries(projects, (project, cb) => {
console.log(project.name); console.log(project.name);
async.eachSeries(project.files, (file, fileCb) => { async.eachSeries(project.files, (file, fileCb) => {
if (file.url && file.url.includes('p5.js-webeditor')) { if (file.url && file.url.includes('s3-us-west-2.amazonaws.com/')) {
file.url = file.url.replace('p5.js-webeditor', process.env.S3_BUCKET); file.url = file.url.replace('s3-us-west-2.amazonaws.com/', '');
project.save((err, newProject) => { project.save((err, newProject) => {
console.log(`updated file ${file.url}`); console.log(`updated file ${file.url}`);
fileCb(); fileCb();

View file

@ -1,3 +1,3 @@
require('babel-register'); require('babel-register');
require('babel-polyfill'); require('babel-polyfill');
require('./s3UnderUser'); require('./moveBucket');