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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions cmd/sops/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2040,10 +2040,8 @@ func keyservices(c *cli.Context) (svcs []keyservice.KeyServiceClient) {
}

func loadStoresConfig(context *cli.Context, path string) (*config.StoresConfig, error) {
var configPath string
if context.String("config") != "" {
configPath = context.String("config")
} else {
configPath := context.GlobalString("config")
if configPath == "" {
// Ignore config not found errors returned from FindConfigFile since the config file is not mandatory
foundPath, err := config.FindConfigFile(".")
if err != nil {
Expand Down Expand Up @@ -2178,10 +2176,8 @@ func keyGroups(c *cli.Context, file string) ([]sops.KeyGroup, error) {
// Since a config file is not required, this function does not error when one is not found, and instead returns a nil config pointer
func loadConfig(c *cli.Context, file string, kmsEncryptionContext map[string]*string) (*config.Config, error) {
var err error
var configPath string
if c.String("config") != "" {
configPath = c.String("config")
} else {
configPath := c.GlobalString("config")
if configPath == "" {
// Ignore config not found errors returned from FindConfigFile since the config file is not mandatory
configPath, err = config.FindConfigFile(".")
if err != nil {
Expand Down
Loading