@cocreate/acme 1.2.2 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.2.3](https://github.com/CoCreate-app/CoCreate-acme/compare/v1.2.2...v1.2.3) (2024-01-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update to logging ([8e3946d](https://github.com/CoCreate-app/CoCreate-acme/commit/8e3946d6dc8af2719c9d76484e2f35d5b3dbee7b))
7
+
1
8
  ## [1.2.2](https://github.com/CoCreate-app/CoCreate-acme/compare/v1.2.1...v1.2.2) (2024-01-08)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/acme",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "An intergration with ACME and CoCreateJS.",
5
5
  "keywords": [
6
6
  "acme",
package/src/index.js CHANGED
@@ -169,8 +169,6 @@ class CoCreateAcme {
169
169
  expires = expires.notAfter;
170
170
  this.setCertificate(host, expires, organization_id, hostKeyPath, cert, key)
171
171
 
172
- console.log(`saving host: ${host} at postion: ${hostPosition}`)
173
-
174
172
  this.crud.send({
175
173
  method: 'object.update',
176
174
  host,
@@ -248,57 +246,6 @@ class CoCreateAcme {
248
246
  expires = expires.notAfter;
249
247
  if (this.isValid(expires)) {
250
248
  this.setCertificate(host, expires, organization_id)
251
-
252
- // TODO: remove after certs are synced
253
- let key = fs.readFileSync(hostKeyPath + 'private-key.pem', 'utf8');
254
- let hostPosition, org
255
-
256
- if (!organization_id) {
257
- let org = await this.crud.getHost(host)
258
- if (org.error)
259
- // console.log('Organization could not be found');
260
- return false
261
- else
262
- organization_id = org._id
263
- }
264
-
265
- let organization = await this.crud.getOrganization(organization_id, false);
266
- if (organization.error)
267
- return false
268
-
269
- if (organization.host) {
270
- for (let i = 0; i < organization.host.length; i++) {
271
- if (organization.host[i].name === host) {
272
- hostPosition = i
273
- console.log(`Found host: ${host} at postion: ${hostPosition}`)
274
-
275
- if (organization.host[i].cert && organization.host[i].key) {
276
- let expires = await forge.readCertificateInfo(organization.host[i].cert);
277
- expires = expires.notAfter;
278
- if (this.isValid(expires)) {
279
- this.setCertificate(host, expires, organization_id, hostKeyPath, organization.host[i].cert, organization.host[i].key)
280
- return true
281
- }
282
- }
283
- break
284
- }
285
- }
286
-
287
- if (!hostPosition && hostPosition !== 0)
288
- return false
289
- }
290
-
291
- this.crud.send({
292
- method: 'object.update',
293
- host,
294
- array: 'organizations',
295
- object: {
296
- _id: organization_id,
297
- [`host[${hostPosition}]`]: { name: host, cert, key, expires },
298
- },
299
- organization_id
300
- });
301
-
302
249
  return true
303
250
  }
304
251
  }