⚙️ Config

Gestión centralizada de configuración

Config almacena entradas de configuración JSON por usuario y expone APIs HTTP v0 y v1.

Config

Funcionalidades

Lee y actualiza mapas de configuración sin añadir un servicio propio a tu aplicación.

Configuración de usuario

Usa GET /v1/config y PATCH /v1/config para configuración autenticada por usuario.

Mapa de entradas

Guarda configuración como entradas JSON: strings, números, booleanos y objetos anidados.

Configs v0 legacy

Gestiona documentos de configuración v0 con campos id y entries cuando sea necesario.

Quick start

Inicio rápido

Empieza con Config en segundos usando la API.

curl -X PATCH https://config.hola.cloud/v1/config \
  -H 'X-Glue-Authentication: {"user":{"id":"user-123"}}' \
  -d '{"database.url":"postgres://prod:5432/db","feature.enabled":true}'
PATCH /v1/config HTTP/1.1
Host: config.hola.cloud
X-Glue-Authentication: {"user":{"id":"user-123"}}

{"database.url":"postgres://prod:5432/db","feature.enabled":true}
package main

import (
	"fmt"
	"io"
	"net/http"
	"encoding/json"
	"strings"
)

func main() {
	payload := map[string]any{"database.url": "postgres://prod:5432/db", "feature.enabled": true}
	bodyBytes, err := json.Marshal(payload)
	if err != nil {
		panic(err)
	}
	body := string(bodyBytes)

	req, err := http.NewRequest("PATCH", "https://config.hola.cloud/v1/config", strings.NewReader(body))
	if err != nil {
		panic(err)
	}
	req.Header.Set("X-Glue-Authentication", "{\"user\":{\"id\":\"user-123\"}}")

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	responseBody, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(responseBody))
}
<?php
$payload = ['database.url' => 'postgres://prod:5432/db', 'feature.enabled' => true];
$body = json_encode($payload);

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => 'https://config.hola.cloud/v1/config',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_HTTPHEADER => [
        'X-Glue-Authentication: {"user":{"id":"user-123"}}',
    ],
]);

$response = curl_exec($ch);
if ($response === false) {
    throw new Exception(curl_error($ch));
}
curl_close($ch);

echo $response;
import requests

import json

headers = {
    "X-Glue-Authentication": "{\"user\":{\"id\":\"user-123\"}}",
}

payload = {"database.url": "postgres://prod:5432/db", "feature.enabled": True}
body = json.dumps(payload)

response = requests.request(
    "PATCH",
    "https://config.hola.cloud/v1/config",
    headers=headers,
    data=body
)

print(response.text)
const payload = {"database.url": "postgres://prod:5432/db", "feature.enabled": true};

const response = await fetch("https://config.hola.cloud/v1/config", {
  method: "PATCH",
  headers: {
    "X-Glue-Authentication": "{\"user\":{\"id\":\"user-123\"}}"
  },
  body: JSON.stringify(payload)
});

console.log(await response.text());
const payload = {"database.url": "postgres://prod:5432/db", "feature.enabled": true};

const response = await fetch("https://config.hola.cloud/v1/config", {
  method: "PATCH",
  headers: {
    "X-Glue-Authentication": "{\"user\":{\"id\":\"user-123\"}}"
  },
  body: JSON.stringify(payload)
});

const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;
import java.util.List;

public class Main {
    public static void main(String[] args) throws Exception {
        var payload = Map.of("database.url", "postgres://prod:5432/db", "feature.enabled", true);
        var body = new ObjectMapper().writeValueAsString(payload);

        var request = HttpRequest.newBuilder()
            .uri(URI.create("https://config.hola.cloud/v1/config"))
            .method("PATCH", HttpRequest.BodyPublishers.ofString(body))
            .header("X-Glue-Authentication", "{\"user\":{\"id\":\"user-123\"}}")
            .build();

        var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
Use cases

Casos de uso

Orquestación de microservicios

Build and deploy with Config on HolaCloud's enterprise platform, designed for security, reliability, and scale.

Automatización de pipelines

Build and deploy with Config on HolaCloud's enterprise platform, designed for security, reliability, and scale.

Arquitecturas basadas en eventos

Build and deploy with Config on HolaCloud's enterprise platform, designed for security, reliability, and scale.

Desarrollo de APIs backend

Build and deploy with Config on HolaCloud's enterprise platform, designed for security, reliability, and scale.

Ready to get started?

Explore the documentation or launch the console to start building with Config.

Comentarios

Deja un comentario