gopasspw / gopass

The slightly more awesome standard unix password manager for teams
https://www.gopass.pw/
MIT License
5.81k stars 483 forks source link

config file relies on tabs and spaces #2910

Closed mcnesium closed 1 month ago

mcnesium commented 1 month ago

I built my $XDG_CONFIG_HOME/gopass/config using Nix, but I had to do some ugly fiddling, to make it work:

source = (pkgs.formats.ini { }).generate "gopass.config" {
    …
    "mounts" = {
    "\tpath " = " ${stores}/mcnesium";
    "\tremote " = " ${remote}:passwords/mcnesium.git";
    };

The \t and the spaces around the = were necessary to make the INI format look like this:

[mounts]
    path = /home/mcn/.local/share/gopass/stores/mcnesium
    remote = git@git.qwertz.de:passwords/mcnesium.git

and not like it would generate it without them:

[mounts]
path=/home/mcn/.local/share/gopass/stores/mcnesium
remote=git@git.qwertz.de:passwords/mcnesium.git

With the latter, gopass mounts would simply return that it won't find any configured mounts.

The Nix community argues, gopass would be too picky with the file format, as INI itself would not rely on those tabs and spaces.

timhae commented 1 month ago

You can use the git INI generator https://github.com/NixOS/nixpkgs/blob/cae5d2c7116805121977e4a97616f3e356be15ce/lib/generators.nix#L353

dominikschulz commented 1 month ago

I would argue that Nix has an ... interesting approach.

But I don't think our parser should require the tabs. That seems unnecessary.

The spaces around the equal signs however make more sense and I think we should keep this as is.

dominikschulz commented 1 month ago

I took a look at the current implementation.

Tabs are not required. We're removing any whitespace early on.

Spaces around the equal sign are currently required but I think we could ease the if that's what the INI spec requires.

mcnesium commented 1 month ago

LGTM thanks :wave: