@metric-im/administrate 1.2.4 → 2.0.1

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.
@@ -1,20 +1,10 @@
1
1
  {
2
2
  "permissions": {
3
3
  "allow": [
4
- "Read(//home/msprague/workspace/rootz/epistery/docs/**)",
5
- "Read(//home/msprague/workspace/rootz/epistery/src/**)",
6
- "Read(//home/msprague/workspace/rootz/epistery/**)",
7
- "Read(//home/msprague/workspace/rootz/rhonda/node_modules/epistery/**)",
8
- "Read(//home/msprague/workspace/rootz/rhonda/**)",
9
- "Read(//home/msprague/workspace/metric-im/account-control/**)",
10
- "Bash(sed:*)",
11
- "Bash(git checkout:*)",
12
- "Bash(npm view *)",
13
- "Bash(git --no-pager diff --stat)",
14
- "Bash(node -p \"require\\('./package-lock.json'\\).packages['node_modules/epistery'].version\")",
15
- "Bash(git *)"
4
+ "Read(//home/msprague/workspace/sitewell/**)",
5
+ "Read(//home/msprague/workspace/rootz/data-wallet-demos/**)"
16
6
  ],
17
7
  "deny": [],
18
8
  "ask": []
19
9
  }
20
- }
10
+ }
package/certify.mjs CHANGED
@@ -20,8 +20,7 @@ export class Certify {
20
20
  instance.config = new Config();
21
21
 
22
22
  // Load root config to get contact email
23
- instance.config.setPath('/');
24
- instance.config.load();
23
+ await instance.config.setPath('/');
25
24
 
26
25
  instance.contactEmail = instance.options.contactEmail || instance.config.data.ssl?.email || instance.config.data.profile?.email;
27
26
 
@@ -83,8 +82,7 @@ export class Certify {
83
82
  }
84
83
 
85
84
  // Load domain-specific config to check SSL section
86
- this.config.setPath(`/${sitename}`);
87
- this.config.load();
85
+ await this.config.setPath(`/${sitename}`);
88
86
  const sslConfig = this.config.data.ssl;
89
87
 
90
88
  if (!sslConfig?.certified || moment().isAfter(moment(sslConfig.certified).add(MAX_AGE, 'days'))) {
@@ -106,8 +104,8 @@ export class Certify {
106
104
  }
107
105
  }
108
106
  if (sslConfig?.key && sslConfig?.cert) {
109
- const key = this.config.readFile(sslConfig.key).toString();
110
- const cert = this.config.readFile(sslConfig.cert).toString();
107
+ const key = (await this.config.readFile(sslConfig.key)).toString();
108
+ const cert = (await this.config.readFile(sslConfig.cert)).toString();
111
109
  return {key: key, cert: cert};
112
110
  } else {
113
111
  return null;
@@ -115,8 +113,7 @@ export class Certify {
115
113
  }
116
114
  async renewCert(sitename) {
117
115
  // Load domain config to check SSL certification date
118
- this.config.setPath(`/${sitename}`);
119
- this.config.load();
116
+ await this.config.setPath(`/${sitename}`);
120
117
  const sslConfig = this.config.data.ssl;
121
118
 
122
119
  if (sslConfig?.certified && moment().isBefore(moment(sslConfig.certified).add(MAX_AGE, 'days'))) {
@@ -183,19 +180,19 @@ export class Certify {
183
180
  });
184
181
 
185
182
  // Set path to domain directory and save certificate files there
186
- this.config.setPath(`/${sitename}`);
187
- this.config.writeFile('ssl_cert.pem', cert);
188
- this.config.writeFile('ssl_key.pem', key.toString());
183
+ await this.config.setPath(`/${sitename}`);
184
+ await this.config.writeFile('ssl_cert.pem', cert);
185
+ await this.config.writeFile('ssl_key.pem', key.toString());
189
186
 
190
187
  // Load existing config and add/update [ssl] section
191
- this.config.load();
188
+ await this.config.load();
192
189
  if (!this.config.data.ssl) this.config.data.ssl = {};
193
190
  this.config.data.ssl.key = 'ssl_key.pem';
194
191
  this.config.data.ssl.cert = 'ssl_cert.pem';
195
192
  this.config.data.ssl.certified = moment().format("YYYY-MM-DD");
196
193
 
197
194
  delete this.pending[sitename];
198
- this.config.save();
195
+ await this.config.save();
199
196
 
200
197
  console.log(`Certificate successfully renewed for ${sitename}`);
201
198
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metric-im/administrate",
3
- "version": "1.2.4",
3
+ "version": "2.0.1",
4
4
  "description": "Tools for site administration",
5
5
  "homepage": "https://github.com/metric-im/administrate#readme",
6
6
  "bugs": {
@@ -22,7 +22,7 @@
22
22
  "acme-client": "^5.4.0",
23
23
  "axios": "^1.7.0",
24
24
  "compression": "^1.8.1",
25
- "epistery": "^2.0.2",
25
+ "epistery": "2.2",
26
26
  "express": "^5.1.0",
27
27
  "moment": "^2.30.1"
28
28
  }