[#732] neofs-adm: read contract path only on init

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-08-02 10:18:42 +03:00 committed by Alex Vanin
parent a2f6e07b1d
commit e2cef00497

View file

@ -111,6 +111,7 @@ func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContex
return nil, fmt.Errorf("can't find consensus account: %w", err)
}
var ctrPath string
if cmd.Name() == "init" {
if viper.GetInt64(epochDurationInitFlag) <= 0 {
return nil, fmt.Errorf("epoch duration must be positive")
@ -119,12 +120,12 @@ func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContex
if viper.GetInt64(maxObjectSizeInitFlag) <= 0 {
return nil, fmt.Errorf("max object size must be positive")
}
}
ctrPath, err := cmd.Flags().GetString(contractsInitFlag)
ctrPath, err = cmd.Flags().GetString(contractsInitFlag)
if err != nil {
return nil, fmt.Errorf("missing contracts path: %w", err)
}
}
ns, err := c.GetNativeContracts()
if err != nil {