Restore config layout with 0.1.7 default
This commit is contained in:
@@ -9,17 +9,16 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Server ServerConfig `envconfig:"server"`
|
||||
Database DatabaseConfig `envconfig:"database"`
|
||||
GITEA GITEAConfig `envconfig:"gitea"`
|
||||
Auth AuthConfig `envconfig:"auth"`
|
||||
Logging LoggingConfig `envconfig:"logging"`
|
||||
BACKBEAT BackbeatConfig `envconfig:"backbeat"`
|
||||
Docker DockerConfig `envconfig:"docker"`
|
||||
N8N N8NConfig `envconfig:"n8n"`
|
||||
Server ServerConfig `envconfig:"server"`
|
||||
Database DatabaseConfig `envconfig:"database"`
|
||||
GITEA GITEAConfig `envconfig:"gitea"`
|
||||
Auth AuthConfig `envconfig:"auth"`
|
||||
Logging LoggingConfig `envconfig:"logging"`
|
||||
BACKBEAT BackbeatConfig `envconfig:"backbeat"`
|
||||
Docker DockerConfig `envconfig:"docker"`
|
||||
N8N N8NConfig `envconfig:"n8n"`
|
||||
OpenTelemetry OpenTelemetryConfig `envconfig:"opentelemetry"`
|
||||
Composer ComposerConfig `envconfig:"composer"`
|
||||
TaskAnnouncer TaskAnnouncerConfig `envconfig:"task_announcer"`
|
||||
Composer ComposerConfig `envconfig:"composer"`
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
@@ -45,6 +44,7 @@ type DatabaseConfig struct {
|
||||
MaxIdleConns int `envconfig:"DB_MAX_IDLE_CONNS" default:"5"`
|
||||
}
|
||||
|
||||
|
||||
type GITEAConfig struct {
|
||||
BaseURL string `envconfig:"BASE_URL" required:"true"`
|
||||
Token string `envconfig:"TOKEN"`
|
||||
@@ -52,13 +52,13 @@ type GITEAConfig struct {
|
||||
WebhookPath string `envconfig:"WEBHOOK_PATH" default:"/webhooks/gitea"`
|
||||
WebhookToken string `envconfig:"WEBHOOK_TOKEN"`
|
||||
WebhookTokenFile string `envconfig:"WEBHOOK_TOKEN_FILE"`
|
||||
|
||||
|
||||
// Fetch hardening options
|
||||
EagerFilter bool `envconfig:"EAGER_FILTER" default:"true"` // Pre-filter by labels at API level
|
||||
FullRescan bool `envconfig:"FULL_RESCAN" default:"false"` // Ignore since parameter for full rescan
|
||||
DebugURLs bool `envconfig:"DEBUG_URLS" default:"false"` // Log exact URLs being used
|
||||
MaxRetries int `envconfig:"MAX_RETRIES" default:"3"` // Maximum retry attempts
|
||||
RetryDelay time.Duration `envconfig:"RETRY_DELAY" default:"2s"` // Delay between retries
|
||||
EagerFilter bool `envconfig:"EAGER_FILTER" default:"true"` // Pre-filter by labels at API level
|
||||
FullRescan bool `envconfig:"FULL_RESCAN" default:"false"` // Ignore since parameter for full rescan
|
||||
DebugURLs bool `envconfig:"DEBUG_URLS" default:"false"` // Log exact URLs being used
|
||||
MaxRetries int `envconfig:"MAX_RETRIES" default:"3"` // Maximum retry attempts
|
||||
RetryDelay time.Duration `envconfig:"RETRY_DELAY" default:"2s"` // Delay between retries
|
||||
}
|
||||
|
||||
type AuthConfig struct {
|
||||
@@ -75,10 +75,10 @@ type LoggingConfig struct {
|
||||
}
|
||||
|
||||
type BackbeatConfig struct {
|
||||
Enabled bool `envconfig:"ENABLED" default:"true"`
|
||||
ClusterID string `envconfig:"CLUSTER_ID" default:"chorus-production"`
|
||||
AgentID string `envconfig:"AGENT_ID" default:"whoosh"`
|
||||
NATSUrl string `envconfig:"NATS_URL" default:"nats://backbeat-nats:4222"`
|
||||
Enabled bool `envconfig:"ENABLED" default:"true"`
|
||||
ClusterID string `envconfig:"CLUSTER_ID" default:"chorus-production"`
|
||||
AgentID string `envconfig:"AGENT_ID" default:"whoosh"`
|
||||
NATSUrl string `envconfig:"NATS_URL" default:"nats://backbeat-nats:4222"`
|
||||
}
|
||||
|
||||
type DockerConfig struct {
|
||||
@@ -91,60 +91,50 @@ type N8NConfig struct {
|
||||
}
|
||||
|
||||
type OpenTelemetryConfig struct {
|
||||
Enabled bool `envconfig:"ENABLED" default:"true"`
|
||||
ServiceName string `envconfig:"SERVICE_NAME" default:"whoosh"`
|
||||
ServiceVersion string `envconfig:"SERVICE_VERSION" default:"0.1.7"`
|
||||
Environment string `envconfig:"ENVIRONMENT" default:"production"`
|
||||
JaegerEndpoint string `envconfig:"JAEGER_ENDPOINT" default:"http://localhost:14268/api/traces"`
|
||||
SampleRate float64 `envconfig:"SAMPLE_RATE" default:"1.0"`
|
||||
Enabled bool `envconfig:"ENABLED" default:"true"`
|
||||
ServiceName string `envconfig:"SERVICE_NAME" default:"whoosh"`
|
||||
ServiceVersion string `envconfig:"SERVICE_VERSION" default:"0.1.7"`
|
||||
Environment string `envconfig:"ENVIRONMENT" default:"production"`
|
||||
JaegerEndpoint string `envconfig:"JAEGER_ENDPOINT" default:"http://localhost:14268/api/traces"`
|
||||
SampleRate float64 `envconfig:"SAMPLE_RATE" default:"1.0"`
|
||||
}
|
||||
|
||||
type ComposerConfig struct {
|
||||
// Feature flags for experimental features
|
||||
EnableLLMClassification bool `envconfig:"ENABLE_LLM_CLASSIFICATION" default:"false"`
|
||||
EnableLLMSkillAnalysis bool `envconfig:"ENABLE_LLM_SKILL_ANALYSIS" default:"false"`
|
||||
EnableLLMTeamMatching bool `envconfig:"ENABLE_LLM_TEAM_MATCHING" default:"false"`
|
||||
|
||||
EnableLLMClassification bool `envconfig:"ENABLE_LLM_CLASSIFICATION" default:"false"`
|
||||
EnableLLMSkillAnalysis bool `envconfig:"ENABLE_LLM_SKILL_ANALYSIS" default:"false"`
|
||||
EnableLLMTeamMatching bool `envconfig:"ENABLE_LLM_TEAM_MATCHING" default:"false"`
|
||||
|
||||
// Analysis features
|
||||
EnableComplexityAnalysis bool `envconfig:"ENABLE_COMPLEXITY_ANALYSIS" default:"true"`
|
||||
EnableRiskAssessment bool `envconfig:"ENABLE_RISK_ASSESSMENT" default:"true"`
|
||||
EnableAlternativeOptions bool `envconfig:"ENABLE_ALTERNATIVE_OPTIONS" default:"false"`
|
||||
|
||||
EnableComplexityAnalysis bool `envconfig:"ENABLE_COMPLEXITY_ANALYSIS" default:"true"`
|
||||
EnableRiskAssessment bool `envconfig:"ENABLE_RISK_ASSESSMENT" default:"true"`
|
||||
EnableAlternativeOptions bool `envconfig:"ENABLE_ALTERNATIVE_OPTIONS" default:"false"`
|
||||
|
||||
// Debug and monitoring
|
||||
EnableAnalysisLogging bool `envconfig:"ENABLE_ANALYSIS_LOGGING" default:"true"`
|
||||
EnablePerformanceMetrics bool `envconfig:"ENABLE_PERFORMANCE_METRICS" default:"true"`
|
||||
EnableFailsafeFallback bool `envconfig:"ENABLE_FAILSAFE_FALLBACK" default:"true"`
|
||||
|
||||
EnableAnalysisLogging bool `envconfig:"ENABLE_ANALYSIS_LOGGING" default:"true"`
|
||||
EnablePerformanceMetrics bool `envconfig:"ENABLE_PERFORMANCE_METRICS" default:"true"`
|
||||
EnableFailsafeFallback bool `envconfig:"ENABLE_FAILSAFE_FALLBACK" default:"true"`
|
||||
|
||||
// LLM model configuration
|
||||
ClassificationModel string `envconfig:"CLASSIFICATION_MODEL" default:"llama3.1:8b"`
|
||||
SkillAnalysisModel string `envconfig:"SKILL_ANALYSIS_MODEL" default:"llama3.1:8b"`
|
||||
MatchingModel string `envconfig:"MATCHING_MODEL" default:"llama3.1:8b"`
|
||||
|
||||
|
||||
// Performance settings
|
||||
AnalysisTimeoutSecs int `envconfig:"ANALYSIS_TIMEOUT_SECS" default:"60"`
|
||||
AnalysisTimeoutSecs int `envconfig:"ANALYSIS_TIMEOUT_SECS" default:"60"`
|
||||
SkillMatchThreshold float64 `envconfig:"SKILL_MATCH_THRESHOLD" default:"0.6"`
|
||||
}
|
||||
|
||||
type TaskAnnouncerConfig struct {
|
||||
Enabled bool `envconfig:"ENABLED" default:"false"`
|
||||
Interval time.Duration `envconfig:"INTERVAL" default:"2m"`
|
||||
ListenAddresses []string `envconfig:"LISTEN_ADDRESSES" default:"/ip4/0.0.0.0/tcp/0"`
|
||||
BootstrapPeers []string `envconfig:"BOOTSTRAP_PEERS"`
|
||||
MonitorLabels []string `envconfig:"MONITOR_LABELS" default:"bzzz-task"`
|
||||
ReannounceAfter time.Duration `envconfig:"REANNOUNCE_AFTER" default:"12h"`
|
||||
NodeID string `envconfig:"NODE_ID" default:"whoosh-task-announcer"`
|
||||
}
|
||||
|
||||
func readSecretFile(filePath string) (string, error) {
|
||||
if filePath == "" {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
|
||||
content, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to read secret file %s: %w", filePath, err)
|
||||
}
|
||||
|
||||
|
||||
return strings.TrimSpace(string(content)), nil
|
||||
}
|
||||
|
||||
@@ -158,6 +148,7 @@ func (c *Config) loadSecrets() error {
|
||||
c.Database.Password = password
|
||||
}
|
||||
|
||||
|
||||
// Load GITEA token from file if specified
|
||||
if c.GITEA.TokenFile != "" {
|
||||
token, err := readSecretFile(c.GITEA.TokenFile)
|
||||
@@ -258,4 +249,4 @@ func (c *Config) Validate() error {
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user