config

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminConfig

type AdminConfig struct {
	Port     string
	Boundary string
}

admin

type AppConfig

type AppConfig struct {
	Backend      BackendConfig
	Postgres     PostgresDBConfig
	Sqlite       SqliteConfig
	FoundationDB FoundationDBConfig
	// Boundaries []Boundary `mapstructure:"boundaries"`
	Boundaries string

	Grpc struct {
		Port                         string
		EnableReflection             bool
		ConnectionTimeout            time.Duration
		KeepAliveTime                time.Duration
		KeepAliveTimeout             time.Duration
		MaxConcurrentStreams         uint32
		MaxReceiveMessageSize        int
		MaxSendMessageSize           int
		InitialWindowSize            int32
		InitialConnWindowSize        int32
		WriteBufferSize              int
		ReadBufferSize               int
		KeepaliveMinTime             time.Duration
		KeepalivePermitWithoutStream bool
		TLS                          struct {
			Enabled            bool
			CertFile           string
			KeyFile            string
			CAFile             string
			ClientAuthRequired bool
		}
	}

	PollingPublisher struct {
		BatchSize uint32
	}

	Logging LoggingConfig

	Nats NatsConfig
	// Prod bool
	Auth struct {
		AdminUsername string
		AdminPassword string
	}

	Admin AdminConfig

	Pprof struct {
		Enabled bool
		Port    string
	}

	OpenTelemetry struct {
		Enabled     bool
		Endpoint    string
		ServiceName string
	}
	// contains filtered or unexported fields
}

AppConfig represents the application configuration

func InitializeConfig

func InitializeConfig() AppConfig

func LoadConfig

func LoadConfig() (AppConfig, error)

func (*AppConfig) BackendType added in v0.2.7

func (c *AppConfig) BackendType() string

BackendType returns the configured backend, defaulting to "postgres" if unset.

func (*AppConfig) GetBoundaries

func (c *AppConfig) GetBoundaries() *[]Boundary

func (*AppConfig) GetBoundaryNames

func (c *AppConfig) GetBoundaryNames() []string

func (*AppConfig) ParseBoundaries

func (c *AppConfig) ParseBoundaries() error

type BackendConfig added in v0.2.7

type BackendConfig struct {
	Type string
}

BackendConfig selects the storage driver. Values: "postgres" (default), "sqlite", or "foundationdb".

type Boundary

type Boundary struct {
	Name        string
	Description string
}

type BoundaryToPostgresSchemaMapping

type BoundaryToPostgresSchemaMapping struct {
	Schema   string
	Boundary string
}

type FoundationDBConfig added in v0.4.3

type FoundationDBConfig struct {
	ClusterFile string
	APIVersion  int
	Root        string
	// TransactionTimeoutMs bounds each FoundationDB transaction including its
	// internal retries. 0 = backend default (10s); negative = no timeout.
	TransactionTimeoutMs int
	// TransactionRetryLimit caps internal retries per transaction. 0 = unlimited
	// (the timeout is the bound).
	TransactionRetryLimit int
}

FoundationDBConfig holds settings for the FoundationDB backend. The real backend is built with the "foundationdb" build tag because the Go binding requires native FoundationDB client libraries.

type LoggingConfig

type LoggingConfig struct {
	Enabled bool
	Level   string // e.g., "debug", "info", "warn", "error"
}

type NatsClusterConfig

type NatsClusterConfig struct {
	Name     string
	Host     string
	Port     int
	Routes   string
	Username string
	Password string
	Enabled  bool
	Timeout  time.Duration
}

func (*NatsClusterConfig) GetRoutes

func (c *NatsClusterConfig) GetRoutes() []string

type NatsConfig

type NatsConfig struct {
	URL                    string
	ServerName             string
	Port                   int
	MaxPayload             int32
	MaxConnections         int
	StoreDir               string
	EventStreamMaxBytes    int64
	EventStreamMaxMsgs     int64
	EventStreamMaxAge      time.Duration
	PublishAsyncMaxPending int
	Cluster                NatsClusterConfig
}

nats

type PostgresDBConfig

type PostgresDBConfig struct {
	User     string
	Name     string
	Password string
	Host     string
	Port     string
	Schemas  string
	SSLMode  string
	Dialect  string
	// Write pool configuration (optimized for write operations)
	WriteMaxOpenConns    int
	WriteMaxIdleConns    int
	WriteConnMaxIdleTime time.Duration
	WriteConnMaxLifetime time.Duration
	// Read pool configuration (optimized for read operations)
	ReadMaxOpenConns    int
	ReadMaxIdleConns    int
	ReadConnMaxIdleTime time.Duration
	ReadConnMaxLifetime time.Duration
	// AdminConfig pool configuration (optimized for admin operations)
	AdminMaxOpenConns    int
	AdminMaxIdleConns    int
	AdminConnMaxIdleTime time.Duration
	AdminConnMaxLifetime time.Duration
	ListenEnabled        bool
}

postgres

func (PostgresDBConfig) DatabaseDialect added in v0.4.3

func (p PostgresDBConfig) DatabaseDialect() string

func (*PostgresDBConfig) GetSchemaMapping

func (p *PostgresDBConfig) GetSchemaMapping() map[string]BoundaryToPostgresSchemaMapping

type SqliteConfig added in v0.2.7

type SqliteConfig struct {
	Dir               string
	Synchronous       string
	BusyTimeoutMs     int
	ReadPoolSize      int
	CacheSize         int
	MmapSize          int64
	WalAutoCheckpoint int
	TempStore         string
}

SqliteConfig holds settings for the embedded SQLite backend. Each boundary gets its own file at {Dir}/{boundary}.db.

Jump to

Keyboard shortcuts

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