MCPcopy
hub / github.com/getsops/sops / shamirThreshold

Function shamirThreshold

cmd/sops/main.go:2539–2555  ·  view source on GitHub ↗
(c *cli.Context, file string, optionalConfig *config.Config)

Source from the content-addressed store, hash-verified

2537}
2538
2539func shamirThreshold(c *cli.Context, file string, optionalConfig *config.Config) (int, error) {
2540 if c.Int("shamir-secret-sharing-threshold") != 0 {
2541 return c.Int("shamir-secret-sharing-threshold"), nil
2542 }
2543 var err error
2544 conf := optionalConfig
2545 if conf == nil {
2546 conf, err = loadConfig(c, file, nil)
2547 }
2548 if conf == nil {
2549 // This takes care of the following two case:
2550 // 1. No config was provided, or contains no creation rules. Err will be nil and ShamirThreshold will be the default value of 0.
2551 // 2. We did find a config file, but failed to load it. In that case the calling function will print the error and exit.
2552 return 0, err
2553 }
2554 return conf.ShamirThreshold, nil
2555}
2556
2557func jsonValueToTreeInsertableValue(jsonValue string) (interface{}, error) {
2558 var valueToInsert interface{}

Callers 1

getEncryptConfigFunction · 0.85

Calls 1

loadConfigFunction · 0.85

Tested by

no test coverage detected