mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2026-02-03 14:13:26 +00:00
Gdrive token.json without path #301
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jguidini on GitHub.
Hi, I tested provider local, mount a systemd Unit and all worked wonderful. Next step was test on GDrive, we are an educational institution and we have ilimited GDrive. On CLI all works very well, but changing the parameters to use systemd to manage service the things don't go well. After many tests using scritps, monit and systemd I got the problem source, the path of token.json is not configured on source code, by default de binary write to ./ (your same path), but when systemd ou monit call the binary the path is changed (i don't no how) and new autorization to the service is needed.
In file server/storage.go:
571 // Retrieve a token, saves the token, then returns the generated client.
572 func getGDriveClient(config *oauth2.Config) *http.Client {
573 tokenFile := "token.json"
574 tok, err := gDriveTokenFromFile(tokenFile)
575 if err != nil {
576 tok = getGDriveTokenFromWeb(config)
577 saveGDriveToken(tokenFile, tok)
578 }
579 return config.Client(context.Background(), tok)
580 }
We see the file without a path. I do this:
And works! I tested on monit and will test on systemd. Obviosly /opt/transfer.sh/conf is my path, and is my --gdrive-local-config-path.
I'm not a programmer, but know a little.. i will try to do a patch to use --gdrive-local-config-path as path to token.json, but I can't garantee this.
Thanks!
@paolafrancesca commented on GitHub:
@jguidini you're right: fixed with #170
@paolafrancesca commented on GitHub:
@jguidini just for reference: you can set
RootDirectoryandWorkingDirin systemd units to chdir the service to a given directory (https://www.freedesktop.org/software/systemd/man/systemd.exec.html)