Skip to content

Commit 1866b4e

Browse files
fix: update nuv web upload to use the nuv devel minio upload action to ensure it work on both MINIO and CEPH implementation
1 parent 587c765 commit 1866b4e

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

web/nuvfile.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
version: 3
1919

20+
21+
2022
tasks:
2123
upload:
2224
silent: true
@@ -34,3 +36,8 @@ tasks:
3436
sh: wsk property get | awk '/whisk namespace/{print $3}'
3537
APIHOST:
3638
sh: wsk property get | awk '/whisk API host/{print $4}'
39+
AUTHB64:
40+
sh: |
41+
if test -e ~/.wskprops
42+
then source ~/.wskprops; echo $(base64 -e $AUTH)
43+
fi

web/upload.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
const nuv = require('nuv');
1919

20-
const contentActionAddr = `${process.env.APIHOST}/api/v1/web/whisk-system/nuv/content/${process.env.NUVUSER}`;
20+
const contentActionAddr = `${process.env.APIHOST}/api/v1/web/whisk-system/nuv/devel_upload/${process.env.MINIO_BUCKET_STATIC}`;
2121

2222
// *** Main ***
2323
main();
@@ -30,9 +30,8 @@ function main() {
3030
let verbose = extractBoolFromParam(verboseParam);
3131
let clean = extractBoolFromParam(cleanParam);
3232

33-
let minioKey = `MINIO_SECRET_KEY`;
3433

35-
const minioAuth = process.env[minioKey];
34+
const minioAuth = process.env.AUTHB64
3635

3736
const pathFoundAsDir = nuv.isDir(path);
3837
if (!pathFoundAsDir) {
@@ -66,15 +65,15 @@ function main() {
6665

6766
function uploadContent(file, minioAuth, fileAddr, verbose) {
6867
console.log(`Uploading ${fileAddr}...`);
69-
let res = nuv.nuvExec("curl", "-s", "-X", "PUT", "-T", file, "-H", `minioauth: ${minioAuth}`, `${contentActionAddr}/${fileAddr}`);
68+
let res = nuv.nuvExec("curl", "-s", "-X", "PUT", "-T", file, "-H", `x-impersonate-auth: ${minioAuth}`, `${contentActionAddr}/${fileAddr}`);
7069
if (verbose) {
7170
console.log(res);
7271
}
7372
}
7473

7574
function deleteContent(minioAuth, fileAddr, verbose) {
7675
console.log(`Deleting ${fileAddr}...`);
77-
let res = nuv.nuvExec("curl", "-s", "-X", "DELETE", "-H", `minioauth: ${minioAuth}`, `${contentActionAddr}/${fileAddr}`);
76+
let res = nuv.nuvExec("curl", "-s", "-X", "DELETE", "-H", `x-impersonate-auth: ${minioAuth}`, `${contentActionAddr}/${fileAddr}`);
7877
if (verbose) {
7978
console.log(res);
8079
}

0 commit comments

Comments
 (0)