Showing
2 changed files
with
5 additions
and
10 deletions
This diff is collapsed. Click to expand it.
... | @@ -2,16 +2,11 @@ var express = require('express'); | ... | @@ -2,16 +2,11 @@ var express = require('express'); |
2 | var request = require('request'); | 2 | var request = require('request'); |
3 | var async = require('async'); | 3 | var async = require('async'); |
4 | const AWS = require("aws-sdk"); | 4 | const AWS = require("aws-sdk"); |
5 | - | 5 | +AWS.config.loadFromPath(__dirname + "/../modules/awsconfig.json"); |
6 | var cryptoM = require('./../../routes/modules/cryptoM.js'); | 6 | var cryptoM = require('./../../routes/modules/cryptoM.js'); |
7 | 7 | ||
8 | const BUCKET_NAME = "hong-s3-cloud"; | 8 | const BUCKET_NAME = "hong-s3-cloud"; |
9 | - | 9 | +const s3 = new AWS.S3(); |
10 | -const s3 = new AWS.S3({ | ||
11 | - accessKeyId: process.env.AWS_ACCESS_KEY_ID, | ||
12 | - secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, | ||
13 | - region: "ap-northeast-2" | ||
14 | -}); | ||
15 | 10 | ||
16 | var router = express.Router(); | 11 | var router = express.Router(); |
17 | 12 | ||
... | @@ -43,7 +38,7 @@ router.post('/', function(req, res, next) { | ... | @@ -43,7 +38,7 @@ router.post('/', function(req, res, next) { |
43 | } else { | 38 | } else { |
44 | let params = { | 39 | let params = { |
45 | Bucket: BUCKET_NAME, | 40 | Bucket: BUCKET_NAME, |
46 | - Key: user_id + '/', | 41 | + Key: 'drive/' + user_id + '/', |
47 | Body: "", | 42 | Body: "", |
48 | ACL: "public-read-write" | 43 | ACL: "public-read-write" |
49 | }; | 44 | }; |
... | @@ -53,7 +48,7 @@ router.post('/', function(req, res, next) { | ... | @@ -53,7 +48,7 @@ router.post('/', function(req, res, next) { |
53 | } else { | 48 | } else { |
54 | let params2 = { | 49 | let params2 = { |
55 | Bucket: BUCKET_NAME, | 50 | Bucket: BUCKET_NAME, |
56 | - Key: user_id + '/share/', | 51 | + Key: 'drive/' + user_id + '/share/', |
57 | Body: "", | 52 | Body: "", |
58 | ACL: "public-read-write" | 53 | ACL: "public-read-write" |
59 | }; | 54 | }; |
... | @@ -63,7 +58,7 @@ router.post('/', function(req, res, next) { | ... | @@ -63,7 +58,7 @@ router.post('/', function(req, res, next) { |
63 | } else { | 58 | } else { |
64 | let params3 = { | 59 | let params3 = { |
65 | Bucket: BUCKET_NAME, | 60 | Bucket: BUCKET_NAME, |
66 | - Key: user_id + '/trashcan/', | 61 | + Key: 'drive/' + user_id + '/trashcan/', |
67 | Body: "", | 62 | Body: "", |
68 | ACL: "public-read-write" | 63 | ACL: "public-read-write" |
69 | }; | 64 | }; | ... | ... |
-
Please register or login to post a comment