@@ -10,6 +10,10 @@ import (
1010 "github.com/knadh/koanf/v2"
1111 "github.com/mcuadros/go-defaults"
1212 "github.com/rs/zerolog/log"
13+ "github.com/theopenlane/sleuth/internal/cloudflare"
14+ "github.com/theopenlane/sleuth/internal/intel"
15+ "github.com/theopenlane/sleuth/internal/scanner"
16+ "github.com/theopenlane/sleuth/internal/slack"
1317)
1418
1519// envVarPrefix is the prefix for environment variables used to override config values
@@ -23,13 +27,13 @@ type Config struct {
2327 // Server contains HTTP server settings
2428 Server Server `json:"server" koanf:"server"`
2529 // Scanner contains domain scanner settings
26- Scanner Scanner `json:"scanner" koanf:"scanner"`
30+ Scanner scanner. Config `json:"scanner" koanf:"scanner"`
2731 // Intel contains threat intelligence settings
28- Intel Intel `json:"intel" koanf:"intel"`
32+ Intel intel. Config `json:"intel" koanf:"intel"`
2933 // Cloudflare contains Cloudflare API settings
30- Cloudflare Cloudflare `json:"cloudflare" koanf:"cloudflare"`
34+ Cloudflare cloudflare. Config `json:"cloudflare" koanf:"cloudflare"`
3135 // Slack contains Slack webhook settings
32- Slack Slack `json:"slack" koanf:"slack"`
36+ Slack slack. Config `json:"slack" koanf:"slack"`
3337}
3438
3539// Server contains HTTP server configuration
@@ -50,52 +54,6 @@ type Server struct {
5054 MaxBodySize int64 `json:"maxbodysize" koanf:"maxbodysize" default:"102400"`
5155}
5256
53- // Scanner contains domain scanner configuration
54- type Scanner struct {
55- // Timeout is the maximum duration for a scan operation
56- Timeout time.Duration `json:"timeout" koanf:"timeout" default:"120s"`
57- // MaxSubdomains is the maximum number of subdomains to enumerate
58- MaxSubdomains int `json:"maxsubdomains" koanf:"maxsubdomains" default:"50"`
59- // NucleiSeverity is the list of nuclei severity levels to scan for
60- NucleiSeverity []string `json:"nucleiseverity" koanf:"nucleiseverity"`
61- // Verbose enables verbose scanner output
62- Verbose bool `json:"verbose" koanf:"verbose" default:"false"`
63- }
64-
65- // Intel contains threat intelligence configuration
66- type Intel struct {
67- // FeedConfig is the path to the feed configuration JSON file
68- FeedConfig string `json:"feedconfig" koanf:"feedconfig" default:"config/feed_config.json"`
69- // StorageDir is the directory for storing downloaded feed data
70- StorageDir string `json:"storagedir" koanf:"storagedir" default:"data/intel"`
71- // AutoHydrate enables automatic feed hydration on startup
72- AutoHydrate bool `json:"autohydrate" koanf:"autohydrate" default:"false"`
73- // RequestTimeout is the timeout for individual feed download requests
74- RequestTimeout time.Duration `json:"requesttimeout" koanf:"requesttimeout" default:"90s"`
75- // ResolverTimeout is the timeout for DNS lookups during scoring
76- ResolverTimeout time.Duration `json:"resolvertimeout" koanf:"resolvertimeout" default:"10s"`
77- // DNSCacheTTL is the TTL for cached DNS responses
78- DNSCacheTTL time.Duration `json:"dnscachettl" koanf:"dnscachettl" default:"5m"`
79- }
80-
81- // Cloudflare contains Cloudflare API configuration
82- type Cloudflare struct {
83- // AccountID is the Cloudflare account identifier
84- AccountID string `json:"accountid" koanf:"accountid"`
85- // APIToken is the bearer token for Cloudflare API authentication
86- APIToken string `json:"apitoken" koanf:"apitoken" sensitive:"true"`
87- // RequestTimeout is the timeout for Cloudflare API requests
88- RequestTimeout time.Duration `json:"requesttimeout" koanf:"requesttimeout" default:"30s"`
89- }
90-
91- // Slack contains Slack webhook configuration
92- type Slack struct {
93- // WebhookURL is the Slack incoming webhook URL
94- WebhookURL string `json:"webhookurl" koanf:"webhookurl" sensitive:"true"`
95- // RequestTimeout is the timeout for Slack webhook requests
96- RequestTimeout time.Duration `json:"requesttimeout" koanf:"requesttimeout" default:"10s"`
97- }
98-
9957// Option configures the Config
10058type Option func (* Config )
10159
0 commit comments