Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/seo-sidecar / megamind/seo/cmd/main.go |
| Date | Not specified in source |
| Repository | Janady13/seo-sidecar |
| Revision | c66ba23646cf638023e8803dc201dd69089107c9 |
| Branch | main |
| Path or archive member | megamind/seo/cmd/main.go |
| Original SHA-256 | 133ac206f6963a2a855599bd7c21b55dc1f28b4425bf1d7d2e9161536a4ea4a5 |
| Git blob SHA | e9495840039f6fa2439ae6cafe71ab1e74055bc8 |
| Reading-copy SHA-256 | 0b881c7a933d3c99623c6083574da62ea2348943b90ecd9642461eba48512bcf |
Recovered source transcript
Download complete source text ↓83 lines · 2.2 KB
Credential-bearing and unrelated personal details were removed from this reading copy. The source identity and original checksum remain recorded.
package main
import (
"context"
"flag"
"log"
"os"
"os/signal"
"syscall"
"time"
"megamind/seo"
)
func main() {
// Command line flags
sidecarURL := flag.String("sidecar", "http://<SIDECAR_HOST>:9090", "Sidecar URL")
authToken := flag.String("token", "", "Auth token for sidecar")
templateDir := flag.String("templates", "./templates", "Template directory")
dataDir := flag.String("data", "./data", "Data directory for cache/logs")
concurrency := flag.Int("workers", 4, "Number of worker goroutines")
dryRun := flag.Bool("dry-run", false, "Run in dry-run mode (no pushes)")
pollInterval := flag.Duration("poll", 5*time.Minute, "Detection poll interval")
maxPushesPerHour := flag.Int("max-pushes", 10, "Max pushes per site per hour")
flag.Parse()
if *authToken == "" {
*authToken = os.Getenv("SEO_AUTH_TOKEN")
}
if *authToken == "" {
log.Fatal("Auth token required (--token or SEO_AUTH_TOKEN)")
}
// Ensure data directory exists
os.MkdirAll(*dataDir, 0755)
// Create worker
worker, err := seo.NewWorker(seo.WorkerConfig{
SidecarURL: *sidecarURL,
AuthToken: [credential removed],
TemplateDir: *templateDir,
CacheFile: *dataDir + "/cache.json",
LogFile: *dataDir + "/learning.json",
RegistryFile: *dataDir + "/registry.json",
QueueFile: *dataDir + "/queue.json",
FeedbackFile: *dataDir + "/feedback.json",
ExperimentFile: *dataDir + "/experiments.json",
Concurrency: *concurrency,
PollInterval: *pollInterval,
DryRun: *dryRun,
ThrottleConfig: seo.ThrottleConfig{
MaxPushesPerHour: *maxPushesPerHour,
MinIntervalBetween: 5 * time.Minute,
BurstAllowance: 3,
BurstRecoveryMinutes: 20,
},
})
if err != nil {
log.Fatalf("Failed to create worker: %v", err)
}
if *dryRun {
log.Println("Running in DRY-RUN mode - no schemas will be pushed")
}
// Load default site configurations
// In production, these would come from a config file or database
worker.TriggerScan() // Initial scan
// Start worker
ctx, cancel := context.WithCancel(context.Background())
worker.Start(ctx)
// Wait for shutdown signal
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
<-sigCh
log.Println("Shutting down...")
cancel()
worker.Stop()
}