- 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
41 lines
948 B
Go
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")
|
|
}
|