got-your-back icon indicating copy to clipboard operation
got-your-back copied to clipboard

Use `$HOME/.config/gyb` as default config folder

Open wpyoga opened this issue 5 months ago • 3 comments

Hi, I've just tried out GYB and so far it's great -- it saved me lots of time configuring browser extensions and whatnot, just to migrate some emails under a label, from one gmail account to another.

I'm using the Arch AUR version, which hardcodes the default config folder to /var/lib/gyb instead of using the getProgPath() directory. However, on Linux, for a regular user, the typical config folder for an app would be $HOME/.config/APP_NAME.

Therefore I would like to propose that, on Linux:

  • if GYB is run as root, the default config folder is /var/lib/gyb
  • if GYB is run as a regular user, the default config folder is $HOME/.config/gyb

I might be able to contribute code as well, and I would like to know if this approach would be acceptable for your project.

Thanks again! :)

wpyoga avatar Jul 04 '25 16:07 wpyoga

GYB should never be run as root.

jay0lee avatar Jul 04 '25 17:07 jay0lee

Ah, thanks for that info. Also, I'm now reconsidering what would be a good default value for the config folder.

If we have $HOME/.config/gyb as the default folder, then if the user wants to create several projects, they would still have to specify the config folder manually, probably something like $HOME/.config/gyb/[email protected].

The email value can be obtained from the --email parameter used when creating a new project. However, if let's say I'm migrating emails from [email protected] to [email protected], when doing the restore, the email address would be [email protected], so GYB wouldn't be able to automatically find the config folder.

A (hopefully?) better alternative would be to create a new folder when creating a new project, similar to how git does it. So when the user executes the create-project action, a new folder is created. All client secrets and config files used by GYB can then be stored in a .gyb folder, similar to how the .git folder works. Then the user can cd into that folder, such that all actions within that folder will use that same project created on Google Cloud.

The user commands then becomes something like these:

$ gyb --action create-project --email [email protected]

$ cd [email protected]

$ gyb --email [email protected] --search "label:some-label"

$ ls [email protected]

$ gyb --action restore --email [email protected]

What do you think?

wpyoga avatar Jul 05 '25 02:07 wpyoga

Hi @wpyoga,

I'm the person who submitted the PKGBUILD for GYB to Arch AUR repository and just wanted to throw in my two cents.

As you've noticed, the default config folder is changed in the packaged version of the application. The original default - using the application path - doesn’t really work for system-wide installations. On Arch, you definitely don't want to store any configuration or state files in the installation directory - /usr/lib/got-your-back/. The new default (/var/lib/gyb) technically makes more sense as /var/lib is intended to hold application state. But in practice, I don't expect users to run GYB as root, they really shouldn't.

The alternative would be to follow XDG Base Directory specification and set the default config dir to $XDG_CONFIG_HOME/gyb (fallback to $HOME/.config/gyb) . But that doesn't work either, because GYB doesn't automatically create the config directory when running create-project action. Either way user gets an error.

There is not really a good default for the --config-folder in system-wide installs.

If GYB was updated to create the config directory automatically, then defaulting to $HOME/.config/gyb (in Arch version) would make the most sense. That would likely solve the problem for users who only run a single project.

Anyway, if you have any feedback how to improve the AUR package feel free to leave a comment on https://aur.archlinux.org/packages/got-your-back

jmansar avatar Jul 09 '25 22:07 jmansar