@cerema/cadriciel 1.1.2 → 1.1.3

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/login.js CHANGED
@@ -24,7 +24,7 @@ module.exports = function (program) {
24
24
  ])
25
25
  .then(async (answers) => {
26
26
  var client = await S3(answers);
27
- client.get('templates', 'template.json', function (e, r) {
27
+ client.get('cadriciel-templates', 'template.json', function (e, r) {
28
28
  if (e) return log.error('Votre login ou mot de passe incorrecte');
29
29
  makeAccount(JSON.stringify(answers), function (e) {
30
30
  if (e) return log.error('Impossible de créer votre compte.');
@@ -33,6 +33,7 @@ module.exports = function (program) {
33
33
  });
34
34
  })
35
35
  .catch((error) => {
36
+ console.log(error);
36
37
  throw error;
37
38
  });
38
39
  };
package/cmd/update.js CHANGED
@@ -7,7 +7,7 @@ module.exports = function (program) {
7
7
  console.log('- Mise à jour du cadriciel');
8
8
  /** update json */
9
9
  const s3 = await S3();
10
- s3.get('templates', 'template.json', function (e) {
10
+ s3.get('cadriciel-templates', 'template.json', function (e) {
11
11
  fs.rename(
12
12
  os.tmpdir() + '/template.json',
13
13
  os.homedir() + '/.cadriciel/template.json',
package/lib/s3.js CHANGED
@@ -2,13 +2,19 @@ const os = require('os');
2
2
  const fs = require('fs');
3
3
  const util = require('util');
4
4
  const S3_URI = 's3.gra.io.cloud.ovh.net';
5
+ const S3_REGION = 'gra';
5
6
  const Minio = require('minio');
6
7
 
7
8
  const readFile = util.promisify(fs.readFile);
8
9
 
9
10
  const S3 = async function (current_login) {
10
11
  const login = async () => {
12
+ current_login.endPoint = S3_URI;
13
+ current_login.region = S3_REGION;
14
+ if (current_login) return new Minio.Client(current_login);
11
15
  const r = await readFile(`${os.homedir}/.cadriciel/account.json`, 'utf-8');
16
+ r.endPoint = S3_URI;
17
+ r.region = S3_REGION;
12
18
  if (r) return new Minio.Client(JSON.parse(r));
13
19
  };
14
20
  var client = await login(current_login);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerema/cadriciel",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "npm": ">=8.0.0",