config

package
v0.0.0-...-b6e738b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DB is the global ClickHouse connection pool (mainnet-beta)

View Source
var EmbedMigrations embed.FS
View Source
var EnvDBs map[string]driver.Conn

EnvDBs maps environment names to their ClickHouse connection pools. The mainnet-beta entry always points to DB.

View Source
var EnvDatabases map[string]string

EnvDatabases maps environment names to their ClickHouse database names.

View Source
var HealthDB driver.Conn

HealthDB is a separate single-connection pool used exclusively for health checks (/readyz). Keeping it isolated from the main pool prevents cache refresh storms from starving the readiness probe.

View Source
var Neo4jClient neo4j.Client

Neo4jClient is the global read-only Neo4j client

View Source
var Neo4jDatabase string

Neo4jDatabase is the configured database name

View Source
var PgPool *pgxpool.Pool

PgPool is the global PostgreSQL connection pool

View Source
var PublicQueryDB driver.Conn

PublicQueryDB is a ClickHouse connection pool that uses a dedicated read-only user for the AI agent, MCP server, and user-facing query endpoint. Configured via CLICKHOUSE_PUBLIC_QUERY_USERNAME / CLICKHOUSE_PUBLIC_QUERY_PASSWORD. Falls back to DB (main user) if those env vars are not set.

Functions

func AvailableEnvs

func AvailableEnvs() []string

AvailableEnvs returns the list of environments that have databases configured.

func Close

func Close() error

Close closes all ClickHouse connection pools

func CloseNeo4j

func CloseNeo4j() error

CloseNeo4j closes the Neo4j client

func ClosePostgres

func ClosePostgres()

ClosePostgres closes the PostgreSQL connection pool

func DBForEnv

func DBForEnv(env string) driver.Conn

DBForEnv returns the ClickHouse connection pool for the given environment. Falls back to the default DB if the environment is not configured.

func Database

func Database() string

Database returns the configured database name.

func DatabaseForEnv

func DatabaseForEnv(env string) (string, bool)

DatabaseForEnv returns the database name for the given environment. Returns the database name and true if found, or empty string and false if not.

func GetDZDPDB

func GetDZDPDB() string

GetDZDPDB returns the DZDP database name.

func GetPublisherDB

func GetPublisherDB() string

GetPublisherDB returns the publisher database name.

func GetShredderDB

func GetShredderDB() string

GetShredderDB returns the shredder database name.

func Load

func Load() error

Load initializes configuration from environment variables and creates the connection pool

func LoadNeo4j

func LoadNeo4j() error

LoadNeo4j initializes the Neo4j client from environment variables. The client is read-only to prevent accidental writes from the API layer.

func LoadPostgres

func LoadPostgres() error

LoadPostgres initializes the PostgreSQL connection pool

func Neo4jSession

func Neo4jSession(ctx context.Context) neo4j.Session

Neo4jSession creates a new Neo4j session

func SetDZDPDB

func SetDZDPDB(db string)

SetDZDPDB sets the DZDP database name.

func SetDatabase

func SetDatabase(db string)

SetDatabase sets the configured database name.

func SetPublisherDB

func SetPublisherDB(db string)

SetPublisherDB sets the publisher database name.

func SetShredderDB

func SetShredderDB(db string)

SetShredderDB sets the shredder database name.

Types

type CHConfig

type CHConfig struct {
	Addr     string
	Database string
	Username string
	Password string
}

Config holds the ClickHouse configuration

type PgConfig

type PgConfig struct {
	Host     string
	Port     string
	Database string
	Username string
	Password string
}

PgConfig holds the PostgreSQL configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL