@@ -2059,35 +2059,34 @@ func getEncryptConfig(c *cli.Context, fileName string, optionalConfig *config.Co
20592059 unencryptedCommentRegex := c .String ("unencrypted-comment-regex" )
20602060 macOnlyEncrypted := c .Bool ("mac-only-encrypted" )
20612061 var err error
2062- conf := optionalConfig
2063- if conf == nil {
2064- conf , err = loadConfig (c , fileName , nil )
2062+ if optionalConfig == nil {
2063+ optionalConfig , err = loadConfig (c , fileName , nil )
20652064 if err != nil {
20662065 return encryptConfig {}, toExitError (err )
20672066 }
20682067 }
2069- if conf != nil {
2068+ if optionalConfig != nil {
20702069 // command line options have precedence
20712070 if unencryptedSuffix == "" {
2072- unencryptedSuffix = conf .UnencryptedSuffix
2071+ unencryptedSuffix = optionalConfig .UnencryptedSuffix
20732072 }
20742073 if encryptedSuffix == "" {
2075- encryptedSuffix = conf .EncryptedSuffix
2074+ encryptedSuffix = optionalConfig .EncryptedSuffix
20762075 }
20772076 if encryptedRegex == "" {
2078- encryptedRegex = conf .EncryptedRegex
2077+ encryptedRegex = optionalConfig .EncryptedRegex
20792078 }
20802079 if unencryptedRegex == "" {
2081- unencryptedRegex = conf .UnencryptedRegex
2080+ unencryptedRegex = optionalConfig .UnencryptedRegex
20822081 }
20832082 if encryptedCommentRegex == "" {
2084- encryptedCommentRegex = conf .EncryptedCommentRegex
2083+ encryptedCommentRegex = optionalConfig .EncryptedCommentRegex
20852084 }
20862085 if unencryptedCommentRegex == "" {
2087- unencryptedCommentRegex = conf .UnencryptedCommentRegex
2086+ unencryptedCommentRegex = optionalConfig .UnencryptedCommentRegex
20882087 }
20892088 if ! macOnlyEncrypted {
2090- macOnlyEncrypted = conf .MACOnlyEncrypted
2089+ macOnlyEncrypted = optionalConfig .MACOnlyEncrypted
20912090 }
20922091 }
20932092
@@ -2121,13 +2120,13 @@ func getEncryptConfig(c *cli.Context, fileName string, optionalConfig *config.Co
21212120 }
21222121
21232122 var groups []sops.KeyGroup
2124- groups , err = keyGroups (c , fileName , conf )
2123+ groups , err = keyGroups (c , fileName , optionalConfig )
21252124 if err != nil {
21262125 return encryptConfig {}, err
21272126 }
21282127
21292128 var threshold int
2130- threshold , err = shamirThreshold (c , fileName , conf )
2129+ threshold , err = shamirThreshold (c , fileName , optionalConfig )
21312130 if err != nil {
21322131 return encryptConfig {}, err
21332132 }
0 commit comments