jobs-monorepo/apps/cron-analyzer/cmd/cli/main.go
Elshimy Ziad Magdy Taha 8ac872bdc6 feat: restructure project into monorepo with CI/CD
- Reorganized project structure into services/ and apps/ directories for better separation of concerns
- Added comprehensive CI/CD pipeline with GitHub Actions for testing and Docker builds
- Created .dockerignore file to optimize container builds
- Updated Makefile with new targets for each service and application
- Added detailed README with architecture overview, setup instructions and development guidelines
- Moved cron-analyzer to dedicate
2025-11-01 16:20:44 +05:00

41 lines
948 B
Go

package main
import (
"log"
"github.com/jobs-scraper/apps/cron-analyzer/internal"
"github.com/jobs-scraper/internal/pkg/infrastructure"
"github.com/joho/godotenv"
)
func main() {
// Try to load .local.env first, then fallback to .env
if err := godotenv.Load(".local.env"); err != nil {
log.Println("No .local.env file found, trying .env")
if err := godotenv.Load(".env"); err != nil {
log.Println("No .env file found, using system environment variables")
}
}
dbConfig := infrastructure.LoadConfigFromEnv()
db, err := infrastructure.NewConnection(dbConfig)
if err != nil {
log.Fatal("Error connecting to db")
}
err = db.Ping()
if err != nil {
log.Fatal("Error pinging db")
}
log.Println("Successfully connected to db")
analyzer := internal.NewJobAnalyzer(db)
if err := analyzer.AnalyzeJobs(); err != nil {
log.Fatalf("Error analyzing jobs: %v", err)
}
log.Println("Job analysis completed successfully")
}