Skip to main content

Overview

The CNF Service (Configuración) manages system-wide configuration settings and I18N resources for the HERCULES SGI platform. It provides centralized configuration management that other services consume.
Base URL: http://localhost:4281 (development)
Service Path: /config, /resources

Authentication

All endpoints require a valid OAuth2 access token with appropriate permissions.
Authorization: Bearer <access_token>

Configuration Endpoints

List Configurations

Retrieve a paginated list of all configuration entries.
GET /config
q
string
RSQL filter query for searching configurations
s
string
Sorting criteria (e.g., name,asc)
Example Request:
curl -X GET "http://localhost:4281/config?q=name==*time*&s=name,asc" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response:
{
  "content": [
    {
      "name": "time-zone",
      "value": "Europe/Madrid",
      "description": "Default time zone for the application"
    }
  ],
  "totalElements": 1,
  "totalPages": 1,
  "number": 0,
  "size": 10
}

Get Configuration by Name

Retrieve a specific configuration value by its name.
GET /config/{name}
name
string
required
The configuration key name
Example Request:
curl -X GET "http://localhost:4281/config/time-zone" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response:
{
  "name": "time-zone",
  "value": "Europe/Madrid",
  "description": "Default time zone for the application"
}

Create Configuration

Create a new configuration entry.
POST /config
name
string
required
Unique configuration key name
value
string
required
Configuration value
description
string
Optional description of the configuration parameter
Example Request:
curl -X POST "http://localhost:4281/config" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "max-upload-size",
    "value": "10485760",
    "description": "Maximum file upload size in bytes"
  }'

Update Configuration

Update an existing configuration value.
PUT /config/{name}
name
string
required
The configuration key name to update
value
string
required
New configuration value
Example Request:
curl -X PUT "http://localhost:4281/config/time-zone" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "Europe/London"
  }'

Delete Configuration

Delete a configuration entry.
DELETE /config/{name}
name
string
required
The configuration key name to delete
Example Request:
curl -X DELETE "http://localhost:4281/config/max-upload-size" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Restore Default Configuration

Restore a configuration to its default value.
PATCH /config/{name}/restore
name
string
required
The configuration key name to restore
Example Request:
curl -X PATCH "http://localhost:4281/config/time-zone/restore" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Get Time Zone

Retrieve the current system time zone setting.
GET /config/time-zone
Example Request:
curl -X GET "http://localhost:4281/config/time-zone" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response:
{
  "id": "Europe/Madrid",
  "displayName": "Central European Time",
  "rawOffset": 3600000
}

Resource Endpoints

The CNF service also manages I18N resources (translations) for the web interface.

List Resources

Retrieve available language resources.
GET /resources
Example Request:
curl -X GET "http://localhost:4281/resources" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response:
{
  "content": [
    {
      "locale": "es",
      "key": "common.save",
      "value": "Guardar"
    },
    {
      "locale": "en",
      "key": "common.save",
      "value": "Save"
    }
  ]
}

Public Endpoints

The CNF service exposes public endpoints (no authentication required) for configuration and resources that the frontend needs before user login.

Get Public Configuration

GET /public/config/{name}

Get Public Resources

GET /public/resources
Public endpoints return only non-sensitive configuration values that are safe to expose to unauthenticated clients.

Common Configuration Keys

KeyTypeDescriptionDefault
time-zoneStringSystem time zoneEurope/Madrid
date-formatStringDate display formatdd/MM/yyyy
localeStringDefault localees
max-upload-sizeNumberMax file upload size (bytes)10485760

Error Responses

status
number
HTTP status code
error
string
Error type
message
string
Human-readable error message
Example Error Response:
{
  "status": 404,
  "error": "Not Found",
  "message": "Configuration 'invalid-key' not found"
}

Administrator Guide

System configuration and management

Deployment Configuration

Environment and service configuration

Build docs developers (and LLMs) love