simulot / immich-go

An alternative to the immich-CLI command that doesn't depend on nodejs installation. It tries its best for importing google photos takeout archives.
GNU Affero General Public License v3.0
1.2k stars 36 forks source link

Use XDG_CONFIG_HOME for storing config #215

Closed svenstaro closed 1 month ago

svenstaro commented 3 months ago

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.

simulot commented 3 months ago

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.

svenstaro commented 3 months ago

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.

simulot commented 3 months ago

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

simulot commented 1 month ago

Btw the $XDG_CONFIG_HOME isn't set on my system