chore: auto-commit (97 archivos)
- .claude/CLAUDE.md - .claude/agents/fn-recopilador/SKILL.md - .claude/rules/INDEX.md - .claude/rules/cpp_apps.md - bash/functions/infra/build_cpp_windows.sh - cpp/CMakeLists.txt - cpp/PATTERNS.md - cpp/framework/app_base.cpp - cpp/framework/app_base.h - dev/issues/README.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
---
|
||||
name: generate_traefik_dynamic
|
||||
kind: function
|
||||
lang: go
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func GenerateTraefikDynamic(cfg TraefikDynamicConfig) string"
|
||||
description: "Genera el texto YAML de un traefik-dynamic.yml para el file provider de Traefik (Coolify). Replica el patron de apps/registry_api/traefik-dynamic.yml con routers HTTP/HTTPS, redirect, basicAuth opcional y gzip opcional."
|
||||
tags: [traefik, yaml, infra, deploy, generator, basicauth, tls, coolify]
|
||||
uses_functions: []
|
||||
uses_types: [TraefikDynamicConfig_go_infra]
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: [fmt, strings]
|
||||
params:
|
||||
- name: cfg
|
||||
desc: "configuracion del dynamic config: nombre (prefix), dominio, upstream URL, linea htpasswd opcional, flag de gzip y cert resolver"
|
||||
output: "texto YAML completo del traefik-dynamic.yml listo para escribir a disco y recargar en Traefik"
|
||||
tested: true
|
||||
tests:
|
||||
- "render con auth y gzip"
|
||||
- "render sin auth"
|
||||
- "render sin gzip"
|
||||
- "certResolver custom"
|
||||
- "certResolver vacio usa letsencrypt por defecto"
|
||||
- "snapshot YAML completo replica patron registry_api"
|
||||
test_file_path: "functions/infra/generate_traefik_dynamic_test.go"
|
||||
file_path: "functions/infra/generate_traefik_dynamic.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
line, _ := BcryptHtpasswd("lucas", "s3cr3t", 10)
|
||||
cfg := TraefikDynamicConfig{
|
||||
Name: "kanban",
|
||||
Domain: "kanban.organic-machine.com",
|
||||
UpstreamURL: "http://kanban:8421",
|
||||
BasicAuthLine: line,
|
||||
EnableGzip: true,
|
||||
CertResolver: "letsencrypt",
|
||||
}
|
||||
yaml := GenerateTraefikDynamic(cfg)
|
||||
os.WriteFile("apps/kanban/traefik-dynamic.yml", []byte(yaml), 0644)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Funcion pura: dado el mismo `TraefikDynamicConfig` siempre produce el mismo YAML. Si `BasicAuthLine` es vacio se omite el router middleware `<name>-auth` y la seccion `basicAuth`. Si `EnableGzip` es false se omite el middleware `<name>-gzip`. El redirect HTTP→HTTPS siempre esta presente. `CertResolver` por defecto es `"letsencrypt"`. El output usa `$` simple (file provider), no `$$` (Docker labels). Combinar con `BcryptHtpasswd` para generar la linea de auth.
|
||||
Reference in New Issue
Block a user