Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadLanguages ¶
LoadLanguages loads the supported languages from the config.toml file. Returns at least ["en"] — if the config file is missing or has no languages defined, "en" is used as the primary language.
func LoadPostTypes ¶
LoadPostTypes loads custom post types from the config directory If the config file doesn't exist, it returns a service with default post types
func LoadThumbnails ¶
LoadThumbnails loads thumbnail configurations from the config file (config.toml). If the file does not exist, it returns a service with default configs.
func PrimaryLanguage ¶
PrimaryLanguage returns the first language in the slice, or "en" if empty.
Types ¶
type Config ¶
type Config struct {
Host string
Port int
DBPath string
DBDriver string
DBDSN string
DBPoolMaxConns int
JWTSecret string
LogLevel string
SMTPHost string
SMTPPort int
SMTPUser string
SMTPPassword string
SMTPFrom string
ConfigDir string
ConfigFile string
CORSAllowedOrigins string
SiteURL string
DevMode bool
AdminDevURL string
ThemeDir string
PostPerPage int
RateLimitEnabled bool
RateLimitAuthPerMinute int
RateLimitAPIPerMinute int
RateLimitPublicPerMinute int
AIImageGenerationAPIKey string
AIImageGenerationModel string
AIImageGenerationSize string
AIImageGenerationAspectRatio string
AITextGenerationAPIKey string
AITextGenerationBaseURL string
AITextGenerationModel string
APIKeyPepper string
// ImportMaxSizeMB is the ceiling (in megabytes) for any importer upload
// (WordPress WXR now; future importers reuse the same cap). Read via
// IMPORT_MAX_SIZE_MB. Use ImportMaxSize() for the byte value.
ImportMaxSizeMB int
}
Config holds all application configuration
func Load ¶
Load loads configuration from environment variables It tries to load .env file first, then reads from actual environment
func (*Config) ImportMaxSize ¶ added in v0.5.0
ImportMaxSize returns the importer upload ceiling in bytes.
func (*Config) IsImageGenerationEnabled ¶
IsImageGenerationEnabled returns true if the Google Imagen API key is configured
func (*Config) IsTextGenerationEnabled ¶
IsTextGenerationEnabled returns true if the AI text generation API key is configured
func (*Config) ParseCORSOrigins ¶
ParseCORSOrigins parses the comma-separated CORS origins string into a slice It handles whitespace trimming and validates that each origin has a valid http/https scheme
type HomepageSection ¶ added in v0.5.0
type HomepageSection struct {
PostType string `toml:"post_type"`
Limit int `toml:"limit"`
Offset int `toml:"offset"`
Title string `toml:"title"`
}
HomepageSection is one [[homepage_section]] block from config.toml. It tells the public homepage to render a per-post-type grouping in addition to (or instead of relying on) the flat latest-posts list. PostType is the only required field; Limit, Offset, and Title are optional overrides.
func LoadHomepageSections ¶ added in v0.5.0
func LoadHomepageSections(cfg *Config) ([]HomepageSection, error)
LoadHomepageSections reads the [[homepage_section]] blocks from the same config.toml that supplies post types. It mirrors LoadPostTypes: a missing config directory or file yields an empty slice (the homepage then renders the flat latest-posts list — fully backward compatible).
type SiteConfig ¶ added in v0.5.0
SiteConfig is the optional [site_config] block from config.toml. It carries the site's text and visual identity — the values that appear on every public page and that the handler otherwise bakes into the binary (notably the PageTitle suffix and the og:site_name). Both fields are optional; an absent block yields a zero-value SiteConfig, and the caller is expected to default Name to the application name when empty.
func LoadSiteConfig ¶ added in v0.5.0
func LoadSiteConfig(cfg *Config) (SiteConfig, error)
LoadSiteConfig reads the optional [site_config] block from the same config.toml that supplies post types and homepage sections. It mirrors LoadHomepageSections: a missing config directory or file yields a zero-value SiteConfig (fully backward compatible).