fix(serviceconfig): Update service configuration to include dynamic MongoDB connection string and add local permissions settings

This commit is contained in:
2025-08-15 10:12:24 +00:00
parent b187000ae4
commit a86fb3bb8e
3 changed files with 28 additions and 6 deletions

View File

@@ -1,5 +1,11 @@
# Changelog
## 2025-08-15 - 1.17.3 - fix(serviceconfig)
Update service configuration to include dynamic MongoDB connection string and add local permissions settings
- Added .claude/settings.local.json for local permissions configuration
- Updated ServiceConfiguration to compute and update MONGODB_URL based on current config values
## 2025-08-15 - 1.17.2 - fix(ci-test-services)
Update CI/CD configurations, test settings, and Docker service for MongoDB.

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/cli',
version: '1.17.2',
version: '1.17.3',
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
}

View File

@@ -9,6 +9,7 @@ export interface IServiceConfig {
MONGODB_PORT: string;
MONGODB_USER: string;
MONGODB_PASS: string;
MONGODB_URL: string;
S3_HOST: string;
S3_PORT: string;
S3_CONSOLE_PORT: string;
@@ -95,13 +96,20 @@ export class ServiceConfiguration {
s3ConsolePort++;
}
const mongoUser = 'defaultadmin';
const mongoPass = 'defaultpass';
const mongoHost = 'localhost';
const mongoName = projectName;
const mongoPortStr = mongoPort.toString();
this.config = {
PROJECT_NAME: projectName,
MONGODB_HOST: 'localhost',
MONGODB_NAME: projectName,
MONGODB_PORT: mongoPort.toString(),
MONGODB_USER: 'defaultadmin',
MONGODB_PASS: 'defaultpass',
MONGODB_HOST: mongoHost,
MONGODB_NAME: mongoName,
MONGODB_PORT: mongoPortStr,
MONGODB_USER: mongoUser,
MONGODB_PASS: mongoPass,
MONGODB_URL: `mongodb://${mongoUser}:${mongoPass}@${mongoHost}:${mongoPortStr}/${mongoName}?authSource=admin`,
S3_HOST: 'localhost',
S3_PORT: s3Port.toString(),
S3_CONSOLE_PORT: s3ConsolePort.toString(),
@@ -164,6 +172,14 @@ export class ServiceConfiguration {
updated = true;
}
// Always update MONGODB_URL based on current settings
const oldUrl = this.config.MONGODB_URL;
this.config.MONGODB_URL = `mongodb://${this.config.MONGODB_USER}:${this.config.MONGODB_PASS}@${this.config.MONGODB_HOST}:${this.config.MONGODB_PORT}/${this.config.MONGODB_NAME}?authSource=admin`;
if (oldUrl !== this.config.MONGODB_URL) {
fieldsAdded.push('MONGODB_URL');
updated = true;
}
if (!this.config.S3_HOST) {
this.config.S3_HOST = 'localhost';
fieldsAdded.push('S3_HOST');