@cocreate/acme 1.2.9 → 1.2.10

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.10](https://github.com/CoCreate-app/CoCreate-acme/compare/v1.2.9...v1.2.10) (2024-04-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * merge hostObject to retain previous configuration reltaed to database ([c9d7c16](https://github.com/CoCreate-app/CoCreate-acme/commit/c9d7c160dfd07f3f5a91c9e2cebab5da2d86ec1c))
7
+
1
8
  ## [1.2.9](https://github.com/CoCreate-app/CoCreate-acme/compare/v1.2.8...v1.2.9) (2024-04-10)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/acme",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
4
4
  "description": "Dynamic SSL certificate management leveraging the ACME protocol, designed for direct API accessibility within applications. Automates certificate creation, renewal, and retrieval, ideal for distributed applications requiring real-time, secure certificate operations.",
5
5
  "keywords": [
6
6
  "acme",
package/src/index.js CHANGED
@@ -76,7 +76,7 @@ class CoCreateAcme {
76
76
  }
77
77
  }
78
78
 
79
- async requestCertificate(host, hostPosition, organization_id, wildcard = false) {
79
+ async requestCertificate(host, hostPosition, hostObject, organization_id, wildcard = false) {
80
80
  try {
81
81
 
82
82
  const self = this
@@ -175,7 +175,7 @@ class CoCreateAcme {
175
175
  array: 'organizations',
176
176
  object: {
177
177
  _id: organization_id,
178
- [`host[${hostPosition}]`]: { name: host, cert, key, expires },
178
+ [`host[${hostPosition}]`]: { ...hostObject, name: host, cert, key, expires },
179
179
  },
180
180
  organization_id
181
181
  });
@@ -192,7 +192,7 @@ class CoCreateAcme {
192
192
 
193
193
  async getCertificate(host, organization_id) {
194
194
  const hostKeyPath = keyPath + host + '/';
195
- let hostPosition
195
+ let hostPosition, hostObject
196
196
 
197
197
  let organization = await this.crud.getOrganization({ host, organization_id });
198
198
  if (organization.error)
@@ -204,6 +204,7 @@ class CoCreateAcme {
204
204
  for (let i = 0; i < organization.host.length; i++) {
205
205
  if (organization.host[i].name === host) {
206
206
  hostPosition = i
207
+ hostObject = organization.host[i]
207
208
  if (organization.host[i].cert && organization.host[i].key) {
208
209
  let expires = await forge.readCertificateInfo(organization.host[i].cert);
209
210
  expires = expires.notAfter;
@@ -220,7 +221,7 @@ class CoCreateAcme {
220
221
  return false
221
222
  }
222
223
 
223
- return await this.requestCertificate(host, hostPosition, organization_id, false)
224
+ return await this.requestCertificate(host, hostPosition, hostObject, organization_id, false)
224
225
  }
225
226
 
226
227
  async checkCertificate(host, organization_id, pathname = '') {