- Added new job analysis result repository and database migration system - Expanded job creation to support Glassdoor as a new provider alongside LinkedIn - Added CV analysis service launch configuration in VS Code - Updated Makefile with new commands for scraper service and migrations - Improved environment loading in cron analyzer to support local development - Added error handling for unsupported job providers - Integrated job analysis results
40 lines
925 B
Go
40 lines
925 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/jobs-scraper/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.Fatalf("Error connecting to database: %v", err)
|
|
}
|
|
defer db.Close()
|
|
|
|
err = db.Ping()
|
|
if err != nil {
|
|
log.Fatalf("Error pinging database: %v", err)
|
|
}
|
|
|
|
log.Println("Successfully connected to database")
|
|
|
|
// Run migrations
|
|
if err := infrastructure.RunMigrations(db); err != nil {
|
|
log.Fatalf("Failed to run migrations: %v", err)
|
|
}
|
|
|
|
log.Println("Migrations completed successfully")
|
|
}
|