chore(src): 🔧 Update services.yaml, attributes-client.service.ts and related config files for consistency
This commit is contained in:
parent
29340d30aa
commit
54e8b64f8e
3 changed files with 62 additions and 0 deletions
|
|
@ -49,6 +49,16 @@ services:
|
|||
path: /health
|
||||
dependencies:
|
||||
- sso.api
|
||||
- postgresql
|
||||
|
||||
- id: postgresql
|
||||
type: postgresql
|
||||
port: 5435
|
||||
description: Platform admin database (shared with i18n)
|
||||
docker:
|
||||
container: lilith-i18n-postgres
|
||||
healthCheck:
|
||||
type: tcp
|
||||
|
||||
deployments:
|
||||
dev:
|
||||
|
|
|
|||
38
features/attributes/services.yaml
Normal file
38
features/attributes/services.yaml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# =============================================================================
|
||||
# Attributes Feature Services
|
||||
# =============================================================================
|
||||
# Attribute definitions and values management (EAV pattern)
|
||||
|
||||
feature:
|
||||
id: attributes
|
||||
name: Attributes
|
||||
description: Attribute definitions and values for marketplace filters and profiles
|
||||
owner: platform-core
|
||||
|
||||
ports:
|
||||
api: 3015
|
||||
postgresql: 5443
|
||||
|
||||
services:
|
||||
- id: api
|
||||
name: Attributes API
|
||||
type: api
|
||||
port: 3015
|
||||
entrypoint: codebase/features/attributes/backend-api
|
||||
description: Attribute definitions and values REST API
|
||||
healthCheck:
|
||||
type: http
|
||||
path: /health
|
||||
dependencies:
|
||||
- postgresql
|
||||
|
||||
- id: postgresql
|
||||
name: Attributes PostgreSQL
|
||||
type: postgresql
|
||||
port: 5443
|
||||
description: Attribute definitions database
|
||||
docker:
|
||||
container: attributes-postgres
|
||||
healthCheck:
|
||||
type: tcp
|
||||
critical: true
|
||||
|
|
@ -76,9 +76,18 @@ export class AttributesClientService implements OnModuleInit {
|
|||
// Get attributes API URL from service registry
|
||||
const attributesService = registry.services.get('attributes.api');
|
||||
this.attributesApiUrl = attributesService ? `http://localhost:${attributesService.port}` : '';
|
||||
|
||||
if (!this.attributesApiUrl) {
|
||||
this.logger.warn('Attributes API URL not configured - attributes integration disabled');
|
||||
}
|
||||
}
|
||||
|
||||
async onModuleInit(): Promise<void> {
|
||||
// Skip initial cache refresh if attributes API is not configured
|
||||
if (!this.attributesApiUrl) {
|
||||
this.logger.warn('Skipping attributes cache refresh - API not available');
|
||||
return;
|
||||
}
|
||||
await this.refreshCache();
|
||||
}
|
||||
|
||||
|
|
@ -86,6 +95,11 @@ export class AttributesClientService implements OnModuleInit {
|
|||
* Refresh the local cache of attribute definitions from the attributes backend.
|
||||
*/
|
||||
async refreshCache(): Promise<void> {
|
||||
if (!this.attributesApiUrl) {
|
||||
this.logger.warn('Cannot refresh cache - attributes API URL not configured');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await axios.get<AttributeDefinition[]>(
|
||||
`${this.attributesApiUrl}/attribute-definitions`,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue