caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

61 lines
1.7 KiB
Go

package doltutil
import (
"fmt"
"time"
mysql "github.com/go-sql-driver/mysql"
)
// ServerDSN holds connection parameters for building a MySQL DSN to a Dolt server.
// All DSNs built with this struct set parseTime=true and multiStatements=true.
type ServerDSN struct {
Socket string // Unix domain socket path; when set, Net="unix" and Host/Port are ignored
Host string
Port int
User string
Password string //nolint:gosec // G117: MySQL DSN password field; required by the connection-string builder, not serialized as JSON
Database string // optional; empty connects without selecting a database
Timeout time.Duration // connect timeout; 0 defaults to 5s
TLS bool
}
// String builds the MySQL DSN string. Always sets parseTime=true,
// multiStatements=true, allowNativePasswords=true, and a connect timeout.
func (d ServerDSN) String() string {
timeout := d.Timeout
if timeout == 0 {
timeout = 5 * time.Second
}
net := "tcp"
addr := fmt.Sprintf("%s:%d", d.Host, d.Port)
if d.Socket != "" {
net = "unix"
addr = d.Socket
}
cfg := mysql.Config{
User: d.User,
Passwd: d.Password,
Net: net,
Addr: addr,
DBName: d.Database,
ParseTime: true,
MultiStatements: true,
Timeout: timeout,
AllowNativePasswords: true,
}
if d.TLS {
cfg.TLSConfig = "true"
} else {
// go-sql-driver/mysql v1.8+ defaults to tls=preferred when TLSConfig
// is empty. Dolt servers without TLS reject preferred-mode negotiation
// with "TLS requested but server does not support TLS". Explicitly
// disable TLS so connections work against non-TLS Dolt instances.
cfg.TLSConfig = "false"
}
return cfg.FormatDSN()
}