@cocreate/acme 1.2.0 → 1.2.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.2.1](https://github.com/CoCreate-app/CoCreate-acme/compare/v1.2.0...v1.2.1) (2024-01-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * handling hostPosition ([fa105b1](https://github.com/CoCreate-app/CoCreate-acme/commit/fa105b1a35927380cd88549d7675eebd2d80a163))
7
+
1
8
  # [1.2.0](https://github.com/CoCreate-app/CoCreate-acme/compare/v1.1.3...v1.2.0) (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.0",
3
+ "version": "1.2.1",
4
4
  "description": "An intergration with ACME and CoCreateJS.",
5
5
  "keywords": [
6
6
  "acme",
package/src/index.js CHANGED
@@ -169,6 +169,8 @@ 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
+
172
174
  this.crud.send({
173
175
  method: 'object.update',
174
176
  host,
@@ -192,6 +194,7 @@ class CoCreateAcme {
192
194
 
193
195
  async getCertificate(host, organization_id) {
194
196
  const hostKeyPath = keyPath + host + '/';
197
+ let hostPosition
195
198
 
196
199
  if (!organization_id) {
197
200
  let org = await this.crud.getHost(host)
@@ -207,7 +210,6 @@ class CoCreateAcme {
207
210
  return false
208
211
 
209
212
  if (organization.host) {
210
- let hostPosition
211
213
  for (let i = 0; i < organization.host.length; i++) {
212
214
  if (organization.host[i].name === host) {
213
215
  hostPosition = i
@@ -223,7 +225,7 @@ class CoCreateAcme {
223
225
  }
224
226
  }
225
227
 
226
- if (hostPosition >= 0)
228
+ if (!hostPosition && hostPosition !== 0)
227
229
  return false
228
230
  }
229
231