kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Merge branch 'master' of https://github.com/OpenDroneMap/NodeODM into python3
commit
f92899639b
|
@ -51,6 +51,7 @@ Options:
|
||||||
--s3_force_path_style Whether to force path style URLs for S3 objects. (default: false)
|
--s3_force_path_style Whether to force path style URLs for S3 objects. (default: false)
|
||||||
--s3_secret_key <secret> S3 secret key, required if --s3_endpoint is set. (default: none)
|
--s3_secret_key <secret> S3 secret key, required if --s3_endpoint is set. (default: none)
|
||||||
--s3_signature_version <version> S3 signature version. (default: 4)
|
--s3_signature_version <version> S3 signature version. (default: 4)
|
||||||
|
--s3_acl <canned-acl> S3 object acl. (default: public-read)
|
||||||
--s3_upload_everything Upload all task results to S3. (default: upload only .zip archive and orthophoto)
|
--s3_upload_everything Upload all task results to S3. (default: upload only .zip archive and orthophoto)
|
||||||
--max_concurrency <number> Place a cap on the max-concurrency option to use for each task. (default: no limit)
|
--max_concurrency <number> Place a cap on the max-concurrency option to use for each task. (default: no limit)
|
||||||
--max_runtime <number> Number of minutes (approximate) that a task is allowed to run before being forcibly canceled (timeout). (default: no limit)
|
--max_runtime <number> Number of minutes (approximate) that a task is allowed to run before being forcibly canceled (timeout). (default: no limit)
|
||||||
|
@ -114,6 +115,7 @@ config.s3ForcePathStyle = argv.s3_force_path_style || fromConfigFile("s3ForcePat
|
||||||
config.s3AccessKey = argv.s3_access_key || fromConfigFile("s3AccessKey", process.env.AWS_ACCESS_KEY_ID || "")
|
config.s3AccessKey = argv.s3_access_key || fromConfigFile("s3AccessKey", process.env.AWS_ACCESS_KEY_ID || "")
|
||||||
config.s3SecretKey = argv.s3_secret_key || fromConfigFile("s3SecretKey", process.env.AWS_SECRET_ACCESS_KEY || "")
|
config.s3SecretKey = argv.s3_secret_key || fromConfigFile("s3SecretKey", process.env.AWS_SECRET_ACCESS_KEY || "")
|
||||||
config.s3SignatureVersion = argv.s3_signature_version || fromConfigFile("s3SignatureVersion", "4")
|
config.s3SignatureVersion = argv.s3_signature_version || fromConfigFile("s3SignatureVersion", "4")
|
||||||
|
config.s3ACL = argv.s3_acl || fromConfigFile("s3_acl", "public-read")
|
||||||
config.s3UploadEverything = argv.s3_upload_everything || fromConfigFile("s3UploadEverything", false);
|
config.s3UploadEverything = argv.s3_upload_everything || fromConfigFile("s3UploadEverything", false);
|
||||||
config.maxConcurrency = parseInt(argv.max_concurrency || fromConfigFile("maxConcurrency", 0));
|
config.maxConcurrency = parseInt(argv.max_concurrency || fromConfigFile("maxConcurrency", 0));
|
||||||
config.maxRuntime = parseInt(argv.max_runtime || fromConfigFile("maxRuntime", -1));
|
config.maxRuntime = parseInt(argv.max_runtime || fromConfigFile("maxRuntime", -1));
|
||||||
|
|
21
libs/S3.js
21
libs/S3.js
|
@ -32,15 +32,24 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(cb){
|
initialize: function(cb){
|
||||||
if (config.s3Endpoint && config.s3Bucket && config.s3AccessKey && config.s3SecretKey){
|
if (config.s3Endpoint && config.s3Bucket){
|
||||||
const spacesEndpoint = new AWS.Endpoint(config.s3Endpoint);
|
const spacesEndpoint = new AWS.Endpoint(config.s3Endpoint);
|
||||||
s3 = new AWS.S3({
|
|
||||||
|
const s3Config = {
|
||||||
endpoint: spacesEndpoint,
|
endpoint: spacesEndpoint,
|
||||||
signatureVersion: ('v' + config.s3SignatureVersion) || 'v4',
|
signatureVersion: ('v' + config.s3SignatureVersion) || 'v4',
|
||||||
accessKeyId: config.s3AccessKey,
|
|
||||||
secretAccessKey: config.s3SecretKey,
|
|
||||||
s3ForcePathStyle: config.s3ForcePathStyle,
|
s3ForcePathStyle: config.s3ForcePathStyle,
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// If we are not using IAM roles then we need to pass access key and secret key in our config
|
||||||
|
if (config.s3AccessKey && config.s3SecretKey) {
|
||||||
|
s3Config['accessKeyId'] = config.s3AccessKey;
|
||||||
|
s3Config['secretAccessKey'] = config.s3SecretKey;
|
||||||
|
}else{
|
||||||
|
logger.info("Secret Key and Access ID not passed. Using the IAM role");
|
||||||
|
};
|
||||||
|
|
||||||
|
s3 = new AWS.S3(s3Config);
|
||||||
|
|
||||||
// Test connection
|
// Test connection
|
||||||
s3.putObject({
|
s3.putObject({
|
||||||
|
@ -76,7 +85,7 @@ module.exports = {
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
Key: file.dest,
|
Key: file.dest,
|
||||||
Body: fs.createReadStream(file.src),
|
Body: fs.createReadStream(file.src),
|
||||||
ACL: 'public-read'
|
ACL: config.s3ACL
|
||||||
}, {partSize: 5 * 1024 * 1024, queueSize: 1}, err => {
|
}, {partSize: 5 * 1024 * 1024, queueSize: 1}, err => {
|
||||||
if (err){
|
if (err){
|
||||||
logger.debug(err);
|
logger.debug(err);
|
||||||
|
|
Ładowanie…
Reference in New Issue