Remove the email pipeline
The mailbox sync (Microsoft Graph and IMAP), its Claude classifier, the /email routes and the Settings page's email section are taken out while the pipeline is unused. The last commit with it is tagged email-pipeline-last; reverting this commit brings it back. The status rules the capture path shares (statusOrder, StatusAdvances, NormalizeStatus) move to job_status.go with their tests. ProcessedEmail stays in the migration, marked dormant, so its history survives for a restored pipeline. golang.org/x/oauth2 is no longer needed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+5
-34
@@ -1,6 +1,5 @@
|
||||
// Command jobtracker is the job application tracker: the applications list,
|
||||
// the leads inbox, the email pipeline that advances applications from the
|
||||
// mailbox, and the capture endpoints behind the browser userscript.
|
||||
// the leads inbox, and the capture endpoints behind the browser userscript.
|
||||
//
|
||||
// It was split out of the adam-french.co.uk backend and is built to sit
|
||||
// behind that site's nginx at /jobs/, borrowing its login (internal/auth).
|
||||
@@ -44,7 +43,7 @@ func main() {
|
||||
// sees are the same. The SPA is built for /jobs/ (web/vite.config.js), so
|
||||
// changing this means rebuilding it with a matching base.
|
||||
basePath := strings.TrimRight(getenv("BASE_PATH", "/jobs"), "/")
|
||||
// The Docker volume: the Graph OAuth session and the capture token.
|
||||
// The Docker volume: the capture token.
|
||||
dataDir := getenv("DATA_DIR", "/data")
|
||||
// The built SPA, copied in by the Dockerfile.
|
||||
staticDir := getenv("STATIC_DIR", "/app/static")
|
||||
@@ -85,31 +84,11 @@ func main() {
|
||||
// Claude feature reports the missing key when it is used.
|
||||
claudeClient := claude.New(os.Getenv("CLAUDE_API_KEY"), os.Getenv("CLAUDE_MODEL"))
|
||||
if os.Getenv("CLAUDE_API_KEY") == "" {
|
||||
log.Println("[Claude] CLAUDE_API_KEY is not set: posting reading, lead scoring and email classification are off")
|
||||
log.Println("[Claude] CLAUDE_API_KEY is not set: posting reading and lead scoring are off")
|
||||
} else {
|
||||
log.Printf("[Claude] using %s", claudeClient.Model())
|
||||
}
|
||||
|
||||
// EMAIL SYNC
|
||||
emailSync := services.InitEmailSync(&services.EmailSyncConfig{
|
||||
Backend: os.Getenv("EMAIL_BACKEND"),
|
||||
ClientID: os.Getenv("MSGRAPH_CLIENT_ID"),
|
||||
ClientSecret: os.Getenv("MSGRAPH_CLIENT_SECRET"),
|
||||
TenantID: os.Getenv("MSGRAPH_TENANT_ID"),
|
||||
RedirectURI: os.Getenv("MSGRAPH_REDIRECT_URI"),
|
||||
IMAP: &services.IMAPConfig{
|
||||
Host: os.Getenv("IMAP_HOST"),
|
||||
Port: os.Getenv("IMAP_PORT"),
|
||||
Email: os.Getenv("IMAP_EMAIL"),
|
||||
Password: os.Getenv("IMAP_PASSWORD"),
|
||||
},
|
||||
// An unparseable value is ignored and the default stands — a typo
|
||||
// here fails quietly.
|
||||
SyncInterval: duration("EMAIL_SYNC_INTERVAL", 30*time.Minute),
|
||||
Enabled: os.Getenv("EMAIL_SYNC_ENABLED") == "true",
|
||||
TokenPath: filepath.Join(dataDir, services.MSGraphTokenFile),
|
||||
}, db, claudeClient)
|
||||
|
||||
// JOB LEADS
|
||||
// Six hours by default: boards change a few times a day at most, and
|
||||
// every run can spend Claude calls.
|
||||
@@ -129,7 +108,7 @@ func main() {
|
||||
log.Println("Job capture token not loaded:", err)
|
||||
}
|
||||
|
||||
store := handlers.Store{DB: db, EmailSync: emailSync, JobLeads: jobLeads, Extractor: claudeClient, CaptureToken: captureToken}
|
||||
store := handlers.Store{DB: db, JobLeads: jobLeads, Extractor: claudeClient, CaptureToken: captureToken}
|
||||
|
||||
r := gin.New()
|
||||
r.Use(gin.Logger(), gin.Recovery())
|
||||
@@ -163,13 +142,6 @@ func main() {
|
||||
admin.POST("/admin/capture-token", store.GenerateCaptureToken)
|
||||
admin.DELETE("/admin/capture-token", store.RevokeCaptureToken)
|
||||
|
||||
// EMAIL SYNC
|
||||
// The callback is open because Microsoft redirects a browser to it; see
|
||||
// CompleteEmailAuth.
|
||||
api.GET("/email/callback", store.CompleteEmailAuth)
|
||||
admin.GET("/email/status", store.EmailSyncStatus)
|
||||
admin.POST("/email/sync", store.TriggerEmailSync)
|
||||
|
||||
// GRAPHQL
|
||||
// auth.Annotate records whether the caller is the admin without refusing
|
||||
// anything; the @admin directive on each field does the refusing, so a
|
||||
@@ -198,12 +170,11 @@ func main() {
|
||||
// Everything else under basePath is the SPA.
|
||||
r.NoRoute(handlers.SPA(staticDir, basePath))
|
||||
|
||||
// The schedulers run until ctx is cancelled, which only happens if r.Run
|
||||
// The scheduler runs until ctx is cancelled, which only happens if r.Run
|
||||
// returns; there is no graceful shutdown, so the container is simply
|
||||
// killed.
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
go emailSync.StartScheduler(ctx)
|
||||
go jobLeads.StartScheduler(ctx)
|
||||
|
||||
port := getenv("PORT", "8080")
|
||||
|
||||
Reference in New Issue
Block a user