Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --config being ignored by loadConfig #1613

Merged
merged 1 commit into from
Sep 14, 2024
Merged

Commits on Sep 14, 2024

  1. Fix --config being ignored by loadConfig

    Use `GlobalString` in `loadConfig` since `--config` is not a sub-command
    flag.
    
    This fixes `--config` being ignored and the CLI erroring out in a
    maddening way:
    
    ```
    % sops --config config/sops.yaml encrypt --input-type json --output-type yaml /dev/stdin < data/test.json | head -n 3
    config file not found, or has no creation rules, and no keys provided through command line options
    % tree
    ./
    ├── config/
    │   └── sops.yaml
    └── data/
        └── test.json
    
    3 directories, 2 files
    % cat config/sops.yaml
    creation_rules:
    - path_regex: .*
      pgp: ADB6276965590A096004F6D1E114CBAE8FA29165
    % cat data/test.json
    {
        "key": 42
    }
    %
    ```
    
    ---
    
    FWIW and future reference, here is how I got a debug build on Nix to
    debug this issue with delve:
    
    ```
    $ cat ~/snippets/sops-debug-build.nix
    sops.overrideAttrs(final: prev: {
      ldflags = [ "-X github.com/getsops/sops/v3/version.Version=${prev.version}" ];
      GOFLAGS = prev.GOFLAGS ++ [ "'-gcflags=all=-N -l'" ];
      dontStrip = true;
    })
    $ nix-store --realise $(nix-instantiate ~/snippets/sops-debug-build.nix)
    ```
    
    Signed-off-by: Louis Opter <[email protected]>
    lopter committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    1b15886 View commit details
    Browse the repository at this point in the history