feat: read-only internal endpoint for GTI Fiscal to mirror clients

GET /internal/fiscal/clients returns every CLIENTE (active and inactive)
as {external_client_id, code, display_name, active} — CLIENTE.ID is the
identity (CODIGO is editable, same reasoning as FUNCIONARIO_PAINEL.ID in
SSO). Authenticated by a dedicated bearer token (FISCAL_INTERNAL_API_TOKEN,
never reused from SESSION_SECRET/SSO key/admin password), rate-limited per
IP, returns 503 rather than opening anonymously when the token isn't
configured. GTI Gerenciador stays the single source of truth: the Fiscal
Hub never receives MySQL credentials.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Gustavo
2026-09-23 22:36:40 -03:00
co-authored by Claude Sonnet 5
parent 161da90e02
commit b1f93c2d68
5 changed files with 178 additions and 0 deletions
+7
View File
@@ -19,6 +19,13 @@ DB_NAME=gtisoftw_clientes_dev
DB_USER=root
DB_PASSWORD=devpassword123
# Endpoint interno read-only GET /internal/fiscal/clients (app/internal_fiscal.py):
# o GTI Fiscal espelha o cadastro de clientes daqui em vez de receber credencial
# MySQL. Token dedicado, compartilhado só com o FISCAL_INTERNAL_API_TOKEN do
# Fiscal — nunca o SESSION_SECRET, a chave privada do SSO ou senha de admin.
# Vazio = endpoint desligado (503).
FISCAL_INTERNAL_API_TOKEN=
# Opcional: integração de LEITURA com a Data Table "pagamentos_processados"
# do n8n, para mostrar os envios automáticos de chave na tela /log. Gere a
# chave em Configurações > API dentro do n8n (devn8n.gtigrupo.com.br).