c8ccd26e04
https://storjlabs.atlassian.net/browse/V3-3491 Change-Id: I9c5f649ded314bb3a2235588c746913a3ec2d203
26 lines
667 B
Go
26 lines
667 B
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package main
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
|
|
"storj.io/storj/cmd/uplink/cmd"
|
|
"storj.io/storj/pkg/process"
|
|
)
|
|
|
|
func main() {
|
|
process.ExecWithCustomConfig(cmd.RootCmd, func(cmd *cobra.Command, vip *viper.Viper) error {
|
|
accessFlag := cmd.Flags().Lookup("access")
|
|
// try to load configuration because we may still need 'accesses' (for named access)
|
|
// field but error only if 'access' flag is not set
|
|
err := process.LoadConfig(cmd, vip)
|
|
if err != nil && (accessFlag == nil || accessFlag.Value.String() == "") {
|
|
return err
|
|
}
|
|
return nil
|
|
})
|
|
}
|