chore: update
ci-api / test (push) Successful in 21m54s
ci-web / test (push) Successful in 17m37s

This commit is contained in:
Xor290
2026-08-02 15:23:43 +02:00
parent 18707e2b3e
commit b82deee4fb
7 changed files with 144 additions and 24 deletions
+9 -3
View File
@@ -56,13 +56,19 @@ type ProvisionConfig struct {
S3Endpoint string
// Load-balancer Telegram (chart lbtelegram) : installé seulement si au
// moins un bot est renseigné. Le reste de la config du chart (DSN
// postgres/redis, secrets JWT/webhook/backend-link) est généré par le
// provisioner, pas saisi par l'admin.
// moins un bot est renseigné. GATEWAY_URL (URL publique de la démo) et
// les DSN/secrets sont générés par le provisioner. Les 3 réglages
// ci-dessous sont optionnels — laissés vides, lbtelegram applique ses
// propres défauts (failover, 300s, 30s — voir internal/config/config.go
// du service lbtelegram).
LBBot1Username string
LBBot1Token string
LBBot2Username string
LBBot2Token string
// LBStrategy : "failover" (défaut) | "roundrobin" | "leastconn"
LBStrategy string
LBJWTTTLSeconds string
LBHealthCheckInterval string // secondes
// Compte admin de l'application déployée (pas le compte omnex de
// l'admin qui lance la démo) — requis : sans lui, personne ne peut se
+21 -13
View File
@@ -35,6 +35,11 @@ type createRequest struct {
LBBot1Token string `json:"lb_bot1_token" binding:"omitempty"`
LBBot2Username string `json:"lb_bot2_username" binding:"omitempty,max=64"`
LBBot2Token string `json:"lb_bot2_token" binding:"omitempty"`
// LBStrategy : "failover" | "roundrobin" | "leastconn" (vide => failover,
// défaut appliqué par lbtelegram lui-même).
LBStrategy string `json:"lb_strategy" binding:"omitempty,oneof=failover roundrobin leastconn"`
LBJWTTTLSeconds string `json:"lb_jwt_ttl_seconds" binding:"omitempty,numeric"`
LBHealthCheckInterval string `json:"lb_health_check_interval" binding:"omitempty,numeric"`
// Compte admin de l'application déployée — requis, sans lui personne ne
// peut se connecter au backoffice de la démo.
@@ -63,19 +68,22 @@ func (h *Handler) Create(c *gin.Context) {
return
}
cfg := ProvisionConfig{
TelegramBotUsername: req.TelegramBotUsername,
TelegramBotToken: req.TelegramBotToken,
NowPaymentsAPIKey: req.NowPaymentsAPIKey,
NowPaymentsIPNSecret: req.NowPaymentsIPNSecret,
StorageDriver: req.StorageDriver,
S3Bucket: req.S3Bucket,
S3Endpoint: req.S3Endpoint,
LBBot1Username: req.LBBot1Username,
LBBot1Token: req.LBBot1Token,
LBBot2Username: req.LBBot2Username,
LBBot2Token: req.LBBot2Token,
AdminUsername: req.AdminUsername,
AdminPassword: req.AdminPassword,
TelegramBotUsername: req.TelegramBotUsername,
TelegramBotToken: req.TelegramBotToken,
NowPaymentsAPIKey: req.NowPaymentsAPIKey,
NowPaymentsIPNSecret: req.NowPaymentsIPNSecret,
StorageDriver: req.StorageDriver,
S3Bucket: req.S3Bucket,
S3Endpoint: req.S3Endpoint,
LBBot1Username: req.LBBot1Username,
LBBot1Token: req.LBBot1Token,
LBBot2Username: req.LBBot2Username,
LBBot2Token: req.LBBot2Token,
LBStrategy: req.LBStrategy,
LBJWTTTLSeconds: req.LBJWTTTLSeconds,
LBHealthCheckInterval: req.LBHealthCheckInterval,
AdminUsername: req.AdminUsername,
AdminPassword: req.AdminPassword,
}
d, err := h.svc.Create(req.LeadID, req.Username, cfg)
if err != nil {
@@ -620,6 +620,31 @@ func (h *HelmProvisioner) buildLBTelegramValues(d Demo, cfg ProvisionConfig, bac
dbURL := fmt.Sprintf("postgres://postgres:demo-postgres-pass@%s-postgresql-postgresql:5432/demo_db?sslmode=disable", d.Namespace)
redisURL := fmt.Sprintf("redis://:demo-redis-pass@%s-redis-redis:6379/0", d.Namespace)
lbRepo, lbTag := parseImage(h.lbtelegramImage)
host := fmt.Sprintf("%s.%s", d.Namespace, h.baseDomain)
env := map[string]string{
"PORT": "8081",
"ENV": "production",
// URL publique HTTPS de cette démo : requise par lbtelegram (panic
// sinon), utilisée pour enregistrer les webhooks Telegram de chaque
// bot (GATEWAY_URL + "/webhook/" + botID) — voir
// deploy/chart-gestion/lbtelegram/templates/ingressroute.yaml pour
// le routage public correspondant.
"GATEWAY_URL": "https://" + host,
"BOT_COUNT": fmt.Sprintf("%d", botCount),
"BOT1_USERNAME": cfg.LBBot1Username,
"BOT2_USERNAME": cfg.LBBot2Username,
"BACKEND_LINK_URL": backendURL,
}
if cfg.LBStrategy != "" {
env["LB_STRATEGY"] = cfg.LBStrategy
}
if cfg.LBJWTTTLSeconds != "" {
env["JWT_TTL_SECONDS"] = cfg.LBJWTTTLSeconds
}
if cfg.LBHealthCheckInterval != "" {
env["HEALTH_CHECK_INTERVAL"] = cfg.LBHealthCheckInterval
}
return map[string]interface{}{
"image": map[string]interface{}{
@@ -627,14 +652,9 @@ func (h *HelmProvisioner) buildLBTelegramValues(d Demo, cfg ProvisionConfig, bac
"tag": lbTag,
"pullPolicy": "Always",
},
"env": map[string]string{
"PORT": "8081",
"ENV": "production",
"BOT_COUNT": fmt.Sprintf("%d", botCount),
"BOT1_USERNAME": cfg.LBBot1Username,
"BOT2_USERNAME": cfg.LBBot2Username,
"BACKEND_LINK_URL": backendURL,
},
"host": host,
"traefikNamespace": sharedTraefikNamespace,
"env": env,
"secrets": map[string]string{
"BOT1_TOKEN": cfg.LBBot1Token,
"BOT2_TOKEN": cfg.LBBot2Token,