@cerema/cadriciel 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cmd/init.js +1 -1
- package/lib/s3.js +2 -8
- package/package.json +1 -1
package/cmd/init.js
CHANGED
|
@@ -33,7 +33,7 @@ module.exports = function (program) {
|
|
|
33
33
|
|
|
34
34
|
const download = async (name, cb) => {
|
|
35
35
|
var client = await S3();
|
|
36
|
-
client.get('templates', `${name}.zip`, function () {
|
|
36
|
+
client.get('cadriciel-templates', `${name}.zip`, function (e) {
|
|
37
37
|
unzipFile(`${os.tmpdir()}/${name}.zip`, `${os.tmpdir()}/${UID}`, () => {
|
|
38
38
|
DEFAULT_TEMPLATE = name;
|
|
39
39
|
fs.unlink(`${os.tmpdir()}/${name}.zip`, cb);
|
package/lib/s3.js
CHANGED
|
@@ -7,18 +7,12 @@ const Minio = require('minio');
|
|
|
7
7
|
const readFile = util.promisify(fs.readFile);
|
|
8
8
|
|
|
9
9
|
const S3 = async function (current_login) {
|
|
10
|
-
const login = async (
|
|
11
|
-
if (current_login) {
|
|
12
|
-
current_login.port = 443;
|
|
13
|
-
current_login.endPoint = S3_URI;
|
|
14
|
-
current_login.useSSL = true;
|
|
15
|
-
current_login.region='gra';
|
|
16
|
-
return new Minio.Client(current_login);
|
|
17
|
-
}
|
|
10
|
+
const login = async () => {
|
|
18
11
|
const r = await readFile(`${os.homedir}/.cadriciel/account.json`, 'utf-8');
|
|
19
12
|
if (r) return new Minio.Client(JSON.parse(r));
|
|
20
13
|
};
|
|
21
14
|
var client = await login(current_login);
|
|
15
|
+
|
|
22
16
|
return {
|
|
23
17
|
get(bucket, filename, cb) {
|
|
24
18
|
client.fGetObject(bucket, filename, `${os.tmpdir()}/${filename}`, cb);
|