immich-go icon indicating copy to clipboard operation
immich-go copied to clipboard

Use XDG_CONFIG_HOME for storing config

Open svenstaro opened this issue 1 year ago • 3 comments

Hey, cool tool. I noticed that you currently store stuff in ~/.immich-go. This is frowned upon and you should prefer saving stuff in $XDG_CONFIG_HOME/.immich-go instead. For most users, this would be ~/.config/immich-go.

svenstaro avatar Apr 01 '24 22:04 svenstaro

I don't think so. The default configuration file directory is given by the go function:

os.UserHomeDir()

For the go documentation:

UserHomeDir returns the current user's home directory.

On Unix, including macOS, it returns the $HOME environment variable. On Windows, it returns %USERPROFILE%. On Plan 9, it returns the $home environment variable.

If the expected variable is not set in the environment, UserHomeDir returns either a platform-specific default value or a non-nil error.

simulot avatar Apr 02 '24 10:04 simulot

From the --help output:

immich-go --help
immich-go  dev, commit none, built at unknown
Usage of main:
  -api string
        Immich api endpoint (http://container_ip:3301)
  -api-trace
        enable api call traces
  -debug
        enable debug messages
  -device-uuid string
        Set a device UUID
  -key string
        API Key
  -log-file string
        Write log messages into the file
  -log-level string
        Log level (Error|Warning|OK|Info), default OK
  -no-colors-log
        Disable colors on logs
  -server string
        Immich server address (http://<your-ip>:2283 or https://<your-domain>)
  -skip-verify-ssl
        Skip SSL verification
  -time-zone string
        Override the system time zone
  -use-configuration string
        Specifies the configuration to use (default "/home/user/.immich-go/immich-go.json")

As we can see, it doesn't use $XDG_CONFIG_HOME or a sensible modern default.

svenstaro avatar Apr 02 '24 11:04 svenstaro

This is just a fix text here. I'll make it clearer

simulot avatar Apr 03 '24 07:04 simulot

Btw the $XDG_CONFIG_HOME isn't set on my system

simulot avatar May 20 '24 14:05 simulot