Documentation
¶
Overview ¶
Package app provides the main application logic for immich-go, including client management for connecting to Immich servers.
Index ¶
- Variables
- func Banner() string
- func DefaultLogFile() string
- func GetVersion() string
- func NewFilteredHandler(handler slog.Handler) slog.Handler
- type Application
- func (app *Application) FileProcessor() *fileprocessor.FileProcessor
- func (app *Application) GetSupportedMedia() filetypes.SupportedMedia
- func (app *Application) GetTZ() *time.Location
- func (app *Application) Jnl() *fileevent.Recorder
- func (app *Application) Log() *Log
- func (app *Application) ProcessError(err error) error
- func (app *Application) RegisterFlags(flags *pflag.FlagSet)
- func (app *Application) SetFileProcessor(processor *fileprocessor.FileProcessor)
- func (app *Application) SetJnl(jnl *fileevent.Recorder)
- func (app *Application) SetLog(log *Log)
- func (app *Application) SetSupportedMedia(sm filetypes.SupportedMedia)
- func (app *Application) SetTZ(tz *time.Location)
- type Client
- type FilteredHandler
- type Log
- func (log *Log) APITracer() *httptrace.Tracer
- func (log *Log) Close(ctx context.Context, cmd *cobra.Command, app *Application) error
- func (log *Log) GetSLog() *slog.Logger
- func (log *Log) Message(msg string, values ...any)
- func (log *Log) Open(ctx context.Context, cmd *cobra.Command, app *Application) error
- func (log *Log) OpenAPITrace() error
- func (log *Log) OpenLogFile() error
- func (log *Log) RegisterFlags(flags *pflag.FlagSet)
- func (log *Log) SetLogWriter(w io.Writer) *slog.Logger
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" Commit = "none" Date = "unknown" )
Functions ¶
func Banner ¶
func Banner() string
String generate a string with new lines and place the given text on the latest line
func DefaultLogFile ¶ added in v0.29.0
func DefaultLogFile() string
DefaultLogFile returns the default log file path
func GetVersion ¶
func GetVersion() string
Types ¶
type Application ¶
type Application struct {
// CLI flags
DryRun bool
OnErrors cliflags.OnErrorsFlag
SaveConfig bool
ConcurrentTask int
CfgFile string
Config *config.ConfigurationManager
// contains filtered or unexported fields
}
func (*Application) FileProcessor ¶ added in v0.30.0
func (app *Application) FileProcessor() *fileprocessor.FileProcessor
FileProcessor returns the file processor for coordinated asset tracking and event logging
func (*Application) GetSupportedMedia ¶ added in v0.29.0
func (app *Application) GetSupportedMedia() filetypes.SupportedMedia
func (*Application) GetTZ ¶
func (app *Application) GetTZ() *time.Location
func (*Application) Jnl ¶
func (app *Application) Jnl() *fileevent.Recorder
func (*Application) Log ¶
func (app *Application) Log() *Log
func (*Application) ProcessError ¶ added in v0.29.0
func (app *Application) ProcessError(err error) error
func (*Application) RegisterFlags ¶ added in v0.29.0
func (app *Application) RegisterFlags(flags *pflag.FlagSet)
func (*Application) SetFileProcessor ¶ added in v0.30.0
func (app *Application) SetFileProcessor(processor *fileprocessor.FileProcessor)
SetFileProcessor sets the file processor
func (*Application) SetJnl ¶
func (app *Application) SetJnl(jnl *fileevent.Recorder)
func (*Application) SetLog ¶
func (app *Application) SetLog(log *Log)
func (*Application) SetSupportedMedia ¶ added in v0.29.0
func (app *Application) SetSupportedMedia(sm filetypes.SupportedMedia)
func (*Application) SetTZ ¶
func (app *Application) SetTZ(tz *time.Location)
type Client ¶
type Client struct {
Server string `mapstructure:"server" json:"server" toml:"server" yaml:"server"` // Immich server address (http://<your-ip>:2283/api or https://<your-domain>/api)
APIKey string `mapstructure:"api_key" json:"api_key" toml:"api_key" yaml:"api_key"` // API Key
AdminAPIKey string `mapstructure:"admin_api_key" json:"admin_api_key" toml:"admin_api_key" yaml:"admin_api_key"` // API Key for admin
APITrace bool `mapstructure:"api_trace" json:"api_trace" toml:"api_trace" yaml:"api_trace"` // Enable API call traces
SkipSSL bool `mapstructure:"skip_ssl" json:"skip_ssl" toml:"skip_ssl" yaml:"skip_ssl"` // Skip SSL Verification
ClientTimeout time.Duration `mapstructure:"client_timeout" json:"client_timeout" toml:"client_timeout" yaml:"client_timeout"` // Set the client request timeout
DeviceUUID string `mapstructure:"device_uuid" json:"device_uuid" toml:"device_uuid" yaml:"device_uuid"` // Set a device UUID
TimeZone string `mapstructure:"time_zone" json:"time_zone" toml:"time_zone" yaml:"time_zone"` // Override default TZ
APITraceWriter io.WriteCloser `mapstructure:"api_trace_writer" json:"api_trace_writer" toml:"api_trace_writer" yaml:"api_trace_writer"` // API tracer
APITraceWriterName string `mapstructure:"api_trace_writer_name" json:"api_trace_writer_name" toml:"api_trace_writer_name" yaml:"api_trace_writer_name"` // API trace log name
User immich.User `mapstructure:"user" json:"user" toml:"user" yaml:"user"` // User info corresponding to the API key
PauseImmichBackgroundJobs bool `` // Pause Immich background jobs
/* 151-byte string literal not displayed */
TZ *time.Location // Time zone to use
Immich immich.ImmichInterface // Immich client
AdminImmich immich.ImmichInterface // Immich client for admin
ClientLog *slog.Logger // Logger
DryRun bool // Protect the server from changes
// contains filtered or unexported fields
}
Client represents an Immich server client with configuration and connection management. It handles authentication, API communication, and various client-side settings.
func (*Client) Close ¶
Close cleans up the client connection. It logs dry-run status and performs any necessary cleanup operations.
type FilteredHandler ¶ added in v0.28.0
type FilteredHandler struct {
// contains filtered or unexported fields
}
FilteredHandler filterslog messages and filters out context canceled errors if err, ok := a.Value.Any().(error); ok { if errors.Is(err, context.Canceled) {
type Log ¶
type Log struct {
Type string `mapstructure:"type" json:"type" toml:"type" yaml:"type"` // Log format : text|json
File string `mapstructure:"file" json:"file" toml:"file" yaml:"file"` // Log file name
Level string `mapstructure:"level" json:"level" toml:"level" yaml:"level"` // Indicate the log level (string)
*slog.Logger // Logger
// contains filtered or unexported fields
}