config

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config resolves and manages JobForge's on-disk locations. We use os.UserConfigDir so paths follow OS conventions (%APPDATA% on Windows).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyLLMFromEnv added in v0.7.0

func ApplyLLMFromEnv(cfg *AppConfig) bool

ApplyLLMFromEnv sets cfg.LLM from well-known API key environment variables when the current provider is noop or empty. Returns true if it changed cfg.

func ResolveRoot added in v0.7.0

func ResolveRoot() (string, error)

ResolveRoot returns the absolute directory where JobForge stores all user data (config, jobs, profile). It does not depend on the process working directory — run jobforge from any folder like other global CLIs.

Priority: JOBFORGE_HOME → JOBFORGE_DATA_DIR → os.UserConfigDir()/jobforge → $HOME/.jobforge

Types

type AppConfig

type AppConfig struct {
	LLM     LLMSettings     `json:"llm"`
	Google  GoogleSettings  `json:"google,omitempty"`
	IMAP    IMAPSettings    `json:"imap,omitempty"`
	Scraper ScraperSettings `json:"scraper,omitempty"`
}

AppConfig is the user-editable settings file (config.json). It is loaded once per CLI invocation. Keep it small and obvious - anything that needs to be a per-run flag belongs on the command line, not here.

func DefaultAppConfig

func DefaultAppConfig() AppConfig

DefaultAppConfig returns the config we seed for a brand-new install.

type GoogleSettings

type GoogleSettings struct {
	ClientID     string `json:"client_id,omitempty"`
	ClientSecret string `json:"client_secret,omitempty"`
	// CalendarID is the target calendar for new events. Defaults to
	// "primary" if blank.
	CalendarID string `json:"calendar_id,omitempty"`
}

GoogleSettings holds the OAuth client identifiers the user copies out of their Google Cloud project. The CLIENT SECRET in a desktop OAuth app is *not* actually secret in the cryptographic sense (Google's own docs acknowledge this) — it lives in the source of every distributed installer. We store it in config.json as a convenience.

The sensitive value is the user's refresh token, persisted separately at Paths.GoogleTokenFile with restrictive permissions.

type IMAPSettings

type IMAPSettings struct {
	Host     string `json:"host,omitempty"`
	Port     int    `json:"port,omitempty"` // defaults to 993 (IMAPS) when zero
	Username string `json:"username,omitempty"`
	// UseTLS controls whether we use IMAPS (TLS-on-connect) vs STARTTLS.
	// Default true. Plain-text IMAP is intentionally not supported —
	// the user's mailbox is too sensitive to send credentials in clear.
	UseTLS bool `json:"use_tls"`
	// Folder defaults to "INBOX" when blank. Useful to set to a
	// JobForge-specific label (e.g. "JobForge/Applications") if the
	// user pre-filters mail server-side.
	Folder string `json:"folder,omitempty"`
}

IMAPSettings configures the inbox monitor (jobforge inbox poll). The password lives at Paths.IMAPPasswordFile with restrictive perms, not in this struct, so config.json stays safe to share.

type LLMSettings

type LLMSettings struct {
	Provider string `json:"provider"`
	BaseURL  string `json:"base_url,omitempty"`
	APIKey   string `json:"api_key,omitempty"`
	Model    string `json:"model,omitempty"`
}

LLMSettings describes which LLM provider the agents should call.

Supported providers:

  • "noop": default; returns an empty response so the writer falls back to its deterministic template. Requires no other fields.
  • "openai": OpenAI's chat-completions API. Requires APIKey and Model.
  • "anthropic" / "claude": Anthropic Messages API. Requires APIKey and Model.
  • "perplexity": Perplexity's OpenAI-compatible chat API. Requires APIKey and Model.
  • "ollama": local Ollama OpenAI-compatible endpoint. Requires Model; BaseURL defaults to http://localhost:11434/v1.
  • "openai-compatible": any chat-completions endpoint that mirrors OpenAI's shape (OpenAI itself, Together, vLLM, Ollama's OpenAI shim, etc.). Requires BaseURL and Model; APIKey is optional for unauthenticated local deployments.

type Paths

type Paths struct {
	Root             string
	ConfigFile       string
	ProfileFile      string
	JobsFile         string
	SourcesFile      string
	ResumesFile      string
	DraftsDir        string
	ResumesDir       string
	GoogleTokenFile  string
	IMAPPasswordFile string
	InboxStateFile   string
}

Paths groups every file JobForge owns. Holding them on a single struct makes it cheap to override roots in tests with a temp directory.

func Default

func Default() (Paths, error)

Default returns production paths from ResolveRoot (not the process cwd).

func ForRoot

func ForRoot(root string) Paths

ForRoot builds Paths anchored at root. Useful for tests and portable installs.

func (Paths) EnsureDirs

func (p Paths) EnsureDirs() error

EnsureDirs creates the JobForge data directory tree if missing.

type ScraperSettings added in v0.7.0

type ScraperSettings struct {
	// Engine: auto (default), chrome, cloak, or cdp.
	Engine string `json:"engine,omitempty"`
	// CDPURL attaches to a running browser (cloakserve, remote-debugging-port).
	CDPURL string `json:"cdp_url,omitempty"`
	// BinaryPath overrides the CloakBrowser Chromium executable path.
	BinaryPath string `json:"binary_path,omitempty"`
	// Proxy is passed to Chrome as --proxy-server (HTTP or SOCKS5 URL).
	Proxy string `json:"proxy,omitempty"`
	// FingerprintSeed pins CloakBrowser's --fingerprint flag; 0 = random per launch.
	FingerprintSeed int `json:"fingerprint_seed,omitempty"`
}

ScraperSettings configures headless imports (LinkedIn, Indeed, etc.). See https://github.com/CloakHQ/CloakBrowser for the recommended stealth binary.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL