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

[FEATURE REQUEST] Use immich CLI configuration if it already exists #189

Open aniruddhas opened 3 months ago

aniruddhas commented 3 months ago

Hi,

Thanks for this great utility. Its faster than the node client created by immich team and lot better than my clunky bash script which uses exiftools / mediainfo and curl.

It would be a great and simple feature if, immich-go can use : ~/.config/immich/auth.yml if it exists. If there is an option to provide the config file (I have handful of [non tech] home users and I keep their API keys in separate files.) it would be great too!

Thanks again for this great utility!

aniruddhas commented 3 months ago

Thanks a ton!

simulot commented 3 months ago

Let's add the support of immich-cli config file support as well

instanceUrl: http://localhost:3001/api
apiKey: ---redactedkey---
reypm commented 3 months ago

@simulot this is a nice addition and I would like to take advantage of it however I can't find the right syntax to use in the configuration file.

How does the configuration file should looks like?

{
  "instanceUrl": "http://localhost:30041/api",
  "apiKey": "---redactedkey---"
}

or same as CLI options?

{
  "server": "http://localhost:30041/api",
  "key": "---redactedkey---"
}

or should match it what's in the code?

type Configuration struct {
    APIURL    string `json:",omitempty"`
    ServerURL string `json:",omitempty"`
    APIKey    string
}

{
  "ServerURL": "http://localhost:30041/",
  "APIKey": "---redactedkey---",
  "APIURL": "http://localhost:30041/api"
}
simulot commented 3 months ago

The format for immich-go is:

{
  "ServerURL": "http://localhost:2283",
  "APIKey": "theredactedkey"
}

I have discovered after having implemented this that immich-cli is also saving credentials in a file. The file format is about to change. So I'll adapt immich-go to that soon.

aniruddhas commented 3 months ago

Oh, I thought you knew about it. That's what I was referring to in the original post. Re-using existing immich CLI configuration, will make the transition of users to immich-go ... a pretty smooth affair.