Documentation
¶
Index ¶
- func CLIArgs(cfg AppConfig) []string
- func DebugPrint(w io.Writer) error
- func DebugPrintIfEnabled(w io.Writer) (bool, error)
- func EnvironmentMap() (map[string]MetaNode, error)
- func HTMLMap() (map[string]string, error)
- func InjectCLIArgs(osArgs []string, cfg AppConfig) []string
- func WalkMeta(f func(node MetaNode) error) error
- type AppConfig
- type DatabaseConfig
- type EmailConfig
- type GeneralConfig
- type HTTPConfig
- type HTTPSConfig
- type MetaNode
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CLIArgs ¶
CLIArgs generates CLI arguments for PocketBase based on the loaded configuration. It returns a slice of arguments that can be appended to os.Args.
func DebugPrint ¶
DebugPrint prints the current configuration and environment variables to the given writer. If w is nil, it prints to os.Stdout.
func DebugPrintIfEnabled ¶
DebugPrintIfEnabled prints debug information only if debug mode is enabled in the config. Returns true if debug output was printed.
func EnvironmentMap ¶
func InjectCLIArgs ¶
InjectCLIArgs modifies os.Args to include the configuration-based CLI arguments. It intelligently merges with existing arguments, ensuring the "serve" command is present. Returns the modified args slice (also modifies os.Args in place).
Types ¶
type AppConfig ¶
type AppConfig struct {
General GeneralConfig `json:"general"`
Server ServerConfig `json:"server"`
}
AppConfig mirrors the structure of app.config.jsonc at the project root.
func ParseAppConfig ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
QueryTimeoutSeconds int `` /* 156-byte string literal not displayed */
}
DatabaseConfig holds database-specific settings.
type EmailConfig ¶
type EmailConfig struct {
SenderName string `` /* 158-byte string literal not displayed */
SenderAddress string `` /* 162-byte string literal not displayed */
}
EmailConfig holds email sender settings.
type GeneralConfig ¶
type GeneralConfig struct {
Name string `json:"name" env:"APP_GENERAL_NAME" env-description:"The application name."`
Description string `json:"description" env:"APP_GENERAL_DESCRIPTION" env-description:"A brief description of the application."`
Version string `json:"version" env:"APP_GENERAL_VERSION" env-description:"The current version of the application."`
URL string `json:"url" env:"APP_GENERAL_URL" env-description:"The URL this application is hosted at."`
InitialAdminRegistration bool `` /* 163-byte string literal not displayed */
Debug bool `` /* 153-byte string literal not displayed */
}
GeneralConfig holds general application metadata.
type HTTPConfig ¶
type HTTPConfig struct {
Address string `` /* 127-byte string literal not displayed */
Port int `json:"port" env:"APP_SERVER_HTTP_PORT" env-default:"8161" env-description:"TCP port to listen for the HTTP server."`
Enabled bool `json:"enabled" env:"APP_SERVER_HTTP_ENABLED" env-default:"true" env-description:"Enable or disable the HTTP server."`
}
HTTPConfig holds HTTP server settings.
type HTTPSConfig ¶
type HTTPSConfig struct {
Address string `` /* 129-byte string literal not displayed */
Port int `json:"port" env:"APP_SERVER_HTTPS_PORT" env-default:"8443" env-description:"TCP port to listen for the HTTPS server."`
Enabled bool `json:"enabled" env:"APP_SERVER_HTTPS_ENABLED" env-default:"false" env-description:"Enable or disable the HTTPS server."`
}
HTTPSConfig holds HTTPS server settings.
type MetaNode ¶
type ServerConfig ¶
type ServerConfig struct {
HTTP HTTPConfig `json:"http"`
HTTPS HTTPSConfig `json:"https"`
Email EmailConfig `json:"email"`
Database DatabaseConfig `json:"database"`
EncryptionKey *string `` /* 149-byte string literal not displayed */
Domains []string `` /* 147-byte string literal not displayed */
AllowedOrigins []string `` /* 159-byte string literal not displayed */
ForceDevMode bool `` /* 139-byte string literal not displayed */
IndexFallback bool `` /* 135-byte string literal not displayed */
StaticFileServerImmutable bool `` /* 164-byte string literal not displayed */
ReplaceHTMLVars bool `` /* 148-byte string literal not displayed */
}
ServerConfig groups server-specific settings.