fix(core): Fix configuration initialization by accepting a config argument

This commit is contained in:
Philipp Kunz 2024-11-05 21:31:15 +01:00
parent 7eb6bf794c
commit b5433e412f
8 changed files with 60 additions and 53 deletions

View File

@ -1,5 +1,12 @@
# Changelog
## 2024-11-05 - 4.3.3 - fix(core)
Fix configuration initialization by accepting a config argument
- Configuration initialization now accepts an optional config argument
- Updated test cloudly factory to use default public URL and port
- Updated dependencies versions
## 2024-11-05 - 4.3.2 - fix(npmextra)
Updated npm registry URL in npmextra.json

View File

@ -29,7 +29,7 @@
"@git.zone/tstest": "^1.0.90",
"@git.zone/tswatch": "^2.0.25",
"@push.rocks/tapbundle": "^5.3.0",
"@types/node": "^22.8.7"
"@types/node": "^22.9.0"
},
"dependencies": {
"@api.global/typedrequest": "3.1.10",
@ -45,7 +45,7 @@
"@design.estate/dees-element": "^2.0.39",
"@git.zone/tsrun": "^1.3.3",
"@push.rocks/early": "^4.0.3",
"@push.rocks/npmextra": "^5.0.23",
"@push.rocks/npmextra": "^5.1.1",
"@push.rocks/projectinfo": "^5.0.1",
"@push.rocks/qenv": "^6.0.5",
"@push.rocks/smartacme": "^5.0.0",

84
pnpm-lock.yaml generated
View File

@ -45,8 +45,8 @@ dependencies:
specifier: ^4.0.3
version: 4.0.4
'@push.rocks/npmextra':
specifier: ^5.0.23
version: 5.0.23
specifier: ^5.1.1
version: 5.1.1
'@push.rocks/projectinfo':
specifier: ^5.0.1
version: 5.0.2
@ -158,8 +158,8 @@ devDependencies:
specifier: ^5.3.0
version: 5.3.0
'@types/node':
specifier: ^22.8.7
version: 22.8.7
specifier: ^22.9.0
version: 22.9.0
packages:
@ -1909,7 +1909,7 @@ packages:
dependencies:
'@git.zone/tspublish': 1.7.7
'@push.rocks/early': 4.0.4
'@push.rocks/npmextra': 5.0.23
'@push.rocks/npmextra': 5.1.1
'@push.rocks/qenv': 6.0.5
'@push.rocks/smartai': 0.0.17
'@push.rocks/smartcli': 4.0.11
@ -1995,9 +1995,7 @@ packages:
'@push.rocks/smartshell': 3.0.6
'@push.rocks/taskbuffer': 3.1.7
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
dev: true
/@hapi/bourne@3.0.0:
@ -2036,7 +2034,7 @@ packages:
'@inquirer/figures': 1.0.7
'@inquirer/type': 2.0.0
'@types/mute-stream': 0.0.4
'@types/node': 22.8.7
'@types/node': 22.9.0
'@types/wrap-ansi': 3.0.0
ansi-escapes: 4.3.2
cli-width: 4.1.0
@ -2369,8 +2367,8 @@ packages:
- aws-crt
dev: false
/@push.rocks/npmextra@5.0.23:
resolution: {integrity: sha512-12+w6R0XO1pE8xeQUBWyVZp4Ovxkphe4kG5li8uh6hKbRhWwRVow6ilnBqeMb3lZKd9BvESyU2qschiE9Q4vaQ==}
/@push.rocks/npmextra@5.1.1:
resolution: {integrity: sha512-QCmsH7/Bgoi9B3275KTzngj2BUYwbBXjm/YGIeZQu5FNpL2wj9/WMrZOqwSeu/lf41DIEJPsdr7MInpGSf/f8A==}
dependencies:
'@push.rocks/qenv': 6.0.5
'@push.rocks/smartfile': 11.0.21
@ -4038,7 +4036,7 @@ packages:
/@types/accepts@1.3.7:
resolution: {integrity: sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: true
/@types/babel__code-frame@7.0.6:
@ -4049,7 +4047,7 @@ packages:
resolution: {integrity: sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==}
dependencies:
'@types/connect': 3.4.38
'@types/node': 22.8.7
'@types/node': 22.9.0
/@types/buffer-json@2.0.3:
resolution: {integrity: sha512-ItD4UfF3Q5jA+PEV6ZUWEHvlWaXJbd0rpuBKOIrEebM053FHaJddKsgUf0vy7nLSTs44nqFj3Mh8J3TiT0xv4g==}
@ -4071,21 +4069,21 @@ packages:
/@types/clean-css@4.2.11:
resolution: {integrity: sha512-Y8n81lQVTAfP2TOdtJJEsCoYl1AnOkqDqMvXb9/7pfgZZ7r8YrEyurrAvAoAjHOGXKRybay+5CsExqIH6liccw==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
source-map: 0.6.1
dev: true
/@types/co-body@6.1.3:
resolution: {integrity: sha512-UhuhrQ5hclX6UJctv5m4Rfp52AfG9o9+d9/HwjxhVB5NjXxr5t9oKgJxN8xRHgr35oo8meUEHUPFWiKg6y71aA==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
'@types/qs': 6.9.16
dev: true
/@types/connect@3.4.38:
resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
/@types/content-disposition@0.5.8:
resolution: {integrity: sha512-QVSSvno3dE0MgO76pJhmv4Qyi/j0Yk9pBp0Y7TJ2Tlj+KCgJWY6qX7nnxCOLkZ3VYRSIk1WTxCvwUSdx6CCLdg==}
@ -4104,13 +4102,13 @@ packages:
'@types/connect': 3.4.38
'@types/express': 5.0.0
'@types/keygrip': 1.0.6
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: true
/@types/cors@2.8.17:
resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
/@types/debounce@1.2.4:
resolution: {integrity: sha512-jBqiORIzKDOToaF63Fm//haOCHuwQuLa2202RK4MozpA6lh93eCBc+/8+wZn5OzjJt3ySdc+74SXWXB55Ewtyw==}
@ -4131,7 +4129,7 @@ packages:
/@types/express-serve-static-core@4.19.6:
resolution: {integrity: sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
'@types/qs': 6.9.16
'@types/range-parser': 1.2.7
'@types/send': 0.17.4
@ -4139,7 +4137,7 @@ packages:
/@types/express-serve-static-core@5.0.1:
resolution: {integrity: sha512-CRICJIl0N5cXDONAdlTv5ShATZ4HEwk6kDDIW2/w9qOWKg+NU/5F8wYRWCrONad0/UKkloNSmmyN/wX4rtpbVA==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
'@types/qs': 6.9.16
'@types/range-parser': 1.2.7
'@types/send': 0.17.4
@ -4172,37 +4170,37 @@ packages:
/@types/from2@2.3.5:
resolution: {integrity: sha512-giavnjf3kNlJnE+HpZA1CQ3UKHxgehzsTuIMGda8pGMbOiLYGVNADEskey44OZcADHm/HOoBany8IV+0x28XFw==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
/@types/fs-extra@11.0.4:
resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==}
dependencies:
'@types/jsonfile': 6.1.4
'@types/node': 22.8.7
'@types/node': 22.9.0
/@types/fs-extra@9.0.13:
resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: false
/@types/glob@7.2.0:
resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==}
dependencies:
'@types/minimatch': 5.1.2
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: false
/@types/glob@8.1.0:
resolution: {integrity: sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==}
dependencies:
'@types/minimatch': 5.1.2
'@types/node': 22.8.7
'@types/node': 22.9.0
/@types/gunzip-maybe@1.4.2:
resolution: {integrity: sha512-2uqXZg1jTCKE1Pjbab8qb74+f2+i9h/jz8rQ+jRR+zaNJF75zWwrpbX8/TjF4m56m3KFOg9umHdCJ074KwiVxg==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: true
/@types/hast@3.0.4:
@ -4253,12 +4251,12 @@ packages:
/@types/jsonfile@6.1.4:
resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
/@types/jsonwebtoken@9.0.7:
resolution: {integrity: sha512-ugo316mmTYBl2g81zDFnZ7cfxlut3o+/EQdaP7J8QN2kY6lJ22hmQYCK5EHcJHbrW+dkCGSCPgbG8JtYj6qSrg==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: false
/@types/keygrip@1.0.6:
@ -4281,7 +4279,7 @@ packages:
'@types/http-errors': 2.0.4
'@types/keygrip': 1.0.6
'@types/koa-compose': 3.2.8
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: true
/@types/mdast@4.0.4:
@ -4314,20 +4312,20 @@ packages:
/@types/mute-stream@0.0.4:
resolution: {integrity: sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: true
/@types/node-fetch@2.6.11:
resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
form-data: 4.0.1
dev: true
/@types/node-forge@1.3.11:
resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
/@types/node@18.19.64:
resolution: {integrity: sha512-955mDqvO2vFf/oL7V3WiUtiz+BugyX8uVbaT2H8oj3+8dRyH2FLiNdowe7eNqRM7IOIZvzDH76EoAT+gwm6aIQ==}
@ -4335,8 +4333,8 @@ packages:
undici-types: 5.26.5
dev: true
/@types/node@22.8.7:
resolution: {integrity: sha512-LidcG+2UeYIWcMuMUpBKOnryBWG/rnmOHQR5apjn8myTQcx3rinFRn7DcIFhMnS0PPFSC6OafdIKEad0lj6U0Q==}
/@types/node@22.9.0:
resolution: {integrity: sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==}
dependencies:
undici-types: 6.19.8
@ -4367,13 +4365,13 @@ packages:
resolution: {integrity: sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==}
dependencies:
'@types/mime': 1.3.5
'@types/node': 22.8.7
'@types/node': 22.9.0
/@types/serve-static@1.15.7:
resolution: {integrity: sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==}
dependencies:
'@types/http-errors': 2.0.4
'@types/node': 22.8.7
'@types/node': 22.9.0
'@types/send': 0.17.4
/@types/sinon-chai@3.2.12:
@ -4399,19 +4397,19 @@ packages:
/@types/tar-stream@2.2.3:
resolution: {integrity: sha512-if3mugZfjVkXOMZdFjIHySxY13r6GXPpyOlsDmLffvyI7tLz9wXE8BFjNivXsvUeyJ1KNlOpfLnag+ISmxgxPw==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: true
/@types/tar-stream@3.1.3:
resolution: {integrity: sha512-Zbnx4wpkWBMBSu5CytMbrT5ZpMiF55qgM+EpHzR4yIDu7mv52cej8hTkOc6K+LzpkOAbxwn/m7j3iO+/l42YkQ==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: false
/@types/through2@2.0.41:
resolution: {integrity: sha512-ryQ0tidWkb1O1JuYvWKyMLYEtOWDqF5mHerJzKz/gQpoAaJq2l/dsMPBF0B5BNVT34rbARYJ5/tsZwLfUi2kwQ==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
/@types/trusted-types@2.0.7:
resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}
@ -4444,7 +4442,7 @@ packages:
/@types/whatwg-url@8.2.2:
resolution: {integrity: sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
'@types/webidl-conversions': 7.0.3
dev: false
@ -4462,20 +4460,20 @@ packages:
/@types/ws@7.4.7:
resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: true
/@types/ws@8.5.12:
resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==}
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: true
/@types/yauzl@2.10.3:
resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==}
requiresBuild: true
dependencies:
'@types/node': 22.8.7
'@types/node': 22.9.0
dev: true
optional: true
@ -5457,7 +5455,7 @@ packages:
dependencies:
'@types/cookie': 0.4.1
'@types/cors': 2.8.17
'@types/node': 22.8.7
'@types/node': 22.9.0
accepts: 1.3.8
base64id: 2.0.0
cookie: 0.4.2

View File

@ -7,9 +7,9 @@ export const createCloudly = async () => {
const cloudlyConfig: cloudly.ICloudlyConfig = {
cfToken: await testQenv.getEnvVarOnDemand('CF_TOKEN'),
environment: 'integration',
letsEncryptEmail: await testQenv.getEnvVarOnDemand('LETSENCRYPT_EMAIL'),
publicUrl: await testQenv.getEnvVarOnDemand('SERVEZONE_URL'),
publicPort: await testQenv.getEnvVarOnDemand('SERVEZONE_PORT'),
letsEncryptEmail: 'test@serve.zone',
publicUrl: 'localhost',
publicPort: '8080',
mongoDescriptor: {
mongoDbName: await testQenv.getEnvVarOnDemand('MONGODB_DATABASE'),
mongoDbUser: await testQenv.getEnvVarOnDemand('MONGODB_USER'),

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/cloudly',
version: '4.3.2',
version: '4.3.3',
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
}

View File

@ -60,7 +60,8 @@ export class Cloudly {
private readyDeferred = new plugins.smartpromise.Deferred();
constructor() {
private configOptions: plugins.servezoneInterfaces.data.ICloudlyConfig;
constructor(configArg?: plugins.servezoneInterfaces.data.ICloudlyConfig) {
this.cloudlyInfo = new CloudlyInfo(this);
this.config = new CloudlyConfig(this);
@ -90,7 +91,7 @@ export class Cloudly {
*/
public async start() {
// config
await this.config.init();
await this.config.init(this.configOptions);
// manageers
await this.authManager.start();

View File

@ -15,7 +15,7 @@ export class CloudlyConfig {
this.cloudlyRef = cloudlyRefArg;
}
public async init() {
public async init(configArg?: plugins.servezoneInterfaces.data.ICloudlyConfig) {
this.appData =
await plugins.npmextra.AppData.createAndInit<plugins.servezoneInterfaces.data.ICloudlyConfig>(
{
@ -54,6 +54,7 @@ export class CloudlyConfig {
'environment',
'mongoDescriptor',
],
overwriteObject: configArg,
},
);

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/cloudly',
version: '4.3.2',
version: '4.3.3',
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
}