config
config ¶
Configuration management for journal_lib.
This module provides centralized configuration management for the journal_lib package, allowing users to customize behavior through environment variables while providing sensible defaults. All configuration is handled through the JournalConfig class, which supports customization of paths, repositories, GitHub organizations, and user settings.
Example usage
from journal_lib.config import config
Access configured values¶
notes_path = config.notes_dir repo = config.default_repo orgs = config.github_orgs
Environment variables
JOURNAL_NOTES_DIR: Directory containing daily notes (default: ~/notes) JOURNAL_DEFAULT_REPO: Default GitHub repository in owner/repo format JOURNAL_GITHUB_ORGS: Comma-separated list of GitHub organizations to search JOURNAL_GITHUB_USER: GitHub username or '@me' for authenticated user
JournalConfig
dataclass
¶
JournalConfig(
notes_dir: Path = (
lambda: Path(
getenv(
"JOURNAL_NOTES_DIR", str(home() / "notes")
)
)
)(),
default_repo: str = (
lambda: getenv("JOURNAL_DEFAULT_REPO", "")
)(),
github_orgs: list[str] = (lambda: split(","))(),
github_user: str = (
lambda: getenv("JOURNAL_GITHUB_USER", "@me")
)(),
)
Configuration class for journal_lib package.
This class manages all configuration options through environment variables with sensible defaults, making the library portable across different environments and users.
__post_init__ ¶
Validate configuration after initialization.
Source code in packages/journal-lib/src/journal_lib/config.py
get_daily_note_path ¶
Get file system path to daily note file for specified date.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date
|
str | None
|
Date in YYYY-MM-DD format, defaults to today if None |
None
|
Returns:
Type | Description |
---|---|
Path
|
Path object pointing to daily note file |