config

package
v1.0.28 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	// Version is the configuration schema version
	Version int `json:"version,omitempty"`

	// ClaudePath is the custom path to Claude data directory
	ClaudePath string `json:"claude_path,omitempty" env:"TOSAGE_CLAUDE_PATH"`

	// Prometheus holds Prometheus integration configuration
	Prometheus *PrometheusConfig `json:"prometheus,omitempty"`

	// Cursor holds Cursor integration configuration
	Cursor *CursorConfig `json:"cursor,omitempty"`

	// Bedrock holds AWS Bedrock integration configuration
	Bedrock *BedrockConfig `json:"bedrock,omitempty"`

	// VertexAI holds Google Cloud Vertex AI integration configuration
	VertexAI *VertexAIConfig `json:"vertex_ai,omitempty"`

	// Daemon holds daemon mode configuration
	Daemon *DaemonConfig `json:"daemon,omitempty"`

	// Logging holds logging configuration
	Logging *LoggingConfig `json:"logging,omitempty"`

	// CSVExport holds CSV export configuration
	CSVExport *CSVExportConfig `json:"csv_export,omitempty"`

	// ConfigSources tracks the source of each configuration field
	ConfigSources ConfigSourceMap `json:"-"`
}

AppConfig holds application configuration

func DefaultConfig

func DefaultConfig() *AppConfig

DefaultConfig returns the default configuration

func LoadConfig

func LoadConfig() (*AppConfig, error)

LoadConfig loads configuration from environment variables

func MinimalDefaultConfig

func MinimalDefaultConfig() *AppConfig

MinimalDefaultConfig returns the minimal configuration template for initial setup

func (*AppConfig) LoadFromEnv

func (c *AppConfig) LoadFromEnv() error

LoadFromEnv loads configuration from environment variables using Netflix/go-env

func (*AppConfig) MarkDefaults

func (c *AppConfig) MarkDefaults()

MarkDefaults marks all configuration fields as coming from defaults

func (*AppConfig) MergeJSONConfig

func (c *AppConfig) MergeJSONConfig(jsonConfig *AppConfig)

MergeJSONConfig merges JSON configuration into the current configuration

func (*AppConfig) Validate

func (c *AppConfig) Validate() error

Validate validates the configuration

type BedrockConfig added in v1.0.10

type BedrockConfig struct {
	// Enabled indicates if Bedrock tracking is enabled
	Enabled bool `json:"enabled,omitempty" env:"TOSAGE_BEDROCK_ENABLED,default=false"`

	// Regions is the list of AWS regions to monitor
	// Environment variable: TOSAGE_BEDROCK_REGIONS (comma-separated, e.g., "us-east-1,us-west-2,eu-west-1")
	Regions []string `json:"regions,omitempty" env:"TOSAGE_BEDROCK_REGIONS"`

	// AWSProfile is the AWS profile to use (optional)
	AWSProfile string `json:"aws_profile,omitempty" env:"TOSAGE_BEDROCK_AWS_PROFILE,default="`

	// AssumeRoleARN is the ARN of the role to assume (optional)
	AssumeRoleARN string `json:"assume_role_arn,omitempty" env:"TOSAGE_BEDROCK_ASSUME_ROLE_ARN,default="`

	// CollectionIntervalSec is how often to collect metrics in seconds
	CollectionIntervalSec int `json:"collection_interval_seconds,omitempty" env:"TOSAGE_BEDROCK_COLLECTION_INTERVAL_SECONDS,default=600"`
}

BedrockConfig holds AWS Bedrock integration configuration

type CSVExportConfig added in v1.0.12

type CSVExportConfig struct {
	// DefaultOutputPath is the default output directory for CSV files
	DefaultOutputPath string `json:"default_output_path,omitempty" env:"TOSAGE_CSV_EXPORT_DEFAULT_OUTPUT_PATH,default=."`

	// DefaultStartDays is the default number of days to look back for data
	DefaultStartDays int `json:"default_start_days,omitempty" env:"TOSAGE_CSV_EXPORT_DEFAULT_START_DAYS,default=30"`

	// DefaultMetricTypes is the default comma-separated list of metric types to export
	DefaultMetricTypes string `` /* 127-byte string literal not displayed */

	// MaxExportDays is the maximum number of days allowed for export range
	MaxExportDays int `json:"max_export_days,omitempty" env:"TOSAGE_CSV_EXPORT_MAX_EXPORT_DAYS,default=365"`

	// TimeZone is the timezone to use for CSV export (IANA timezone)
	TimeZone string `json:"timezone,omitempty" env:"TOSAGE_CSV_EXPORT_TIMEZONE,default=Asia/Tokyo"`
}

CSVExportConfig holds CSV export configuration

type ConfigSource

type ConfigSource string

ConfigSource represents the source of a configuration value

const (
	SourceDefault     ConfigSource = "default"
	SourceJSONFile    ConfigSource = "json"
	SourceEnvironment ConfigSource = "env"
)

type ConfigSourceMap

type ConfigSourceMap map[string]ConfigSource

ConfigSourceMap tracks the source of each configuration field

type CursorConfig

type CursorConfig struct {
	// DatabasePath is the custom path to Cursor SQLite database
	DatabasePath string `json:"database_path,omitempty" env:"TOSAGE_CURSOR_DB_PATH,default="`

	// APITimeout is the timeout in seconds for Cursor API requests
	APITimeout int `json:"api_timeout,omitempty" env:"TOSAGE_CURSOR_API_TIMEOUT,default=30"`

	// CacheTimeout is the cache timeout in seconds for API responses
	CacheTimeout int `json:"cache_timeout,omitempty" env:"TOSAGE_CURSOR_CACHE_TIMEOUT,default=300"`
}

CursorConfig holds Cursor integration configuration

type DaemonConfig

type DaemonConfig struct {
	// Enabled indicates whether daemon mode is enabled
	Enabled bool `json:"enabled,omitempty" env:"TOSAGE_DAEMON_ENABLED"`

	// StartAtLogin indicates whether to start at system login
	StartAtLogin bool `json:"start_at_login,omitempty" env:"TOSAGE_DAEMON_START_AT_LOGIN"`

	// HideFromDock indicates whether to hide the app from the Dock (macOS only)
	HideFromDock bool `json:"hide_from_dock,omitempty" env:"TOSAGE_DAEMON_HIDE_FROM_DOCK,default=true"`

	// LogPath is the path for daemon log files
	LogPath string `json:"log_path,omitempty" env:"TOSAGE_DAEMON_LOG_PATH"`

	// PidFile is the path for the daemon PID file
	PidFile string `json:"pid_file,omitempty" env:"TOSAGE_DAEMON_PID_FILE"`
}

DaemonConfig holds daemon mode configuration

type LoggingConfig

type LoggingConfig struct {
	// Level is the minimum log level (debug, info, warn, error)
	Level string `json:"level,omitempty" env:"TOSAGE_LOG_LEVEL,default=info"`

	// Debug enables debug mode with stdout logging
	Debug bool `json:"debug,omitempty" env:"TOSAGE_LOG_DEBUG,default=false"`

	// Promtail holds Promtail configuration
	Promtail *PromtailConfig `json:"promtail,omitempty"`
}

LoggingConfig holds logging configuration

type PrometheusConfig

type PrometheusConfig struct {
	// Remote Write configuration
	// RemoteWriteURL is the Prometheus Remote Write endpoint URL
	RemoteWriteURL string `json:"remote_write_url" env:"TOSAGE_PROMETHEUS_REMOTE_WRITE_URL"`

	// RemoteWriteUsername is the username for Remote Write authentication
	RemoteWriteUsername string `json:"remote_write_username" env:"TOSAGE_PROMETHEUS_REMOTE_WRITE_USERNAME"`

	// RemoteWritePassword is the password for Remote Write authentication
	RemoteWritePassword string `json:"remote_write_password" env:"TOSAGE_PROMETHEUS_REMOTE_WRITE_PASSWORD"`

	// Query configuration (new fields)
	// URL is the Prometheus query endpoint URL
	URL string `json:"url" env:"TOSAGE_PROMETHEUS_URL"`

	// Username is the username for query authentication
	Username string `json:"username" env:"TOSAGE_PROMETHEUS_USERNAME"`

	// Password is the password for query authentication
	Password string `json:"password" env:"TOSAGE_PROMETHEUS_PASSWORD"`

	// Common configuration
	// HostLabel is the host label value for metrics
	HostLabel string `json:"host_label,omitempty" env:"TOSAGE_PROMETHEUS_HOST_LABEL"`

	// IntervalSec is the interval in seconds between metric pushes
	IntervalSec int `json:"interval_seconds,omitempty" env:"TOSAGE_PROMETHEUS_INTERVAL_SECONDS,default=600"`

	// TimeoutSec is the timeout in seconds for metric pushes
	TimeoutSec int `json:"timeout_seconds,omitempty" env:"TOSAGE_PROMETHEUS_TIMEOUT_SECONDS,default=30"`
}

PrometheusConfig holds Prometheus integration configuration

type PromtailConfig

type PromtailConfig struct {
	// URL is the Promtail push endpoint URL
	URL string `json:"url" env:"TOSAGE_LOKI_URL,required"`

	// Username is the username for basic authentication
	Username string `json:"username" env:"TOSAGE_LOKI_USERNAME,required"`

	// Password is the password for basic authentication
	Password string `json:"password" env:"TOSAGE_LOKI_PASSWORD,required"`

	// BatchWaitSeconds is the time to wait before sending a batch
	BatchWaitSeconds int `json:"batch_wait_seconds,omitempty" env:"TOSAGE_LOKI_BATCH_WAIT_SECONDS,default=1"`

	// BatchCapacity is the maximum number of log entries in a batch
	BatchCapacity int `json:"batch_capacity,omitempty" env:"TOSAGE_LOKI_BATCH_CAPACITY,default=100"`

	// TimeoutSeconds is the timeout for sending logs
	TimeoutSeconds int `json:"timeout_seconds,omitempty" env:"TOSAGE_LOKI_TIMEOUT_SECONDS,default=5"`
}

PromtailConfig holds Promtail logging configuration

type VertexAIConfig added in v1.0.10

type VertexAIConfig struct {
	// Enabled indicates if Vertex AI tracking is enabled
	Enabled bool `json:"enabled,omitempty" env:"TOSAGE_VERTEX_AI_ENABLED,default=false"`

	// ProjectID is the Google Cloud Project ID
	ProjectID string `json:"project_id,omitempty" env:"TOSAGE_VERTEX_AI_PROJECT_ID,default="`

	// ServiceAccountKeyPath is the path to the service account key file (optional)
	ServiceAccountKeyPath string `json:"service_account_key_path,omitempty" env:"TOSAGE_VERTEX_AI_SERVICE_ACCOUNT_KEY_PATH,default="`

	// ServiceAccountKey is the service account key JSON content (optional)
	ServiceAccountKey string `json:"service_account_key,omitempty" env:"TOSAGE_VERTEX_AI_SERVICE_ACCOUNT_KEY,default="`

	// CollectionIntervalSec is how often to collect metrics in seconds
	CollectionIntervalSec int `json:"collection_interval_seconds,omitempty" env:"TOSAGE_VERTEX_AI_COLLECTION_INTERVAL_SECONDS,default=600"`
}

VertexAIConfig holds Google Cloud Vertex AI integration configuration

Jump to

Keyboard shortcuts

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