Development defaults for configuration (#1430)
added --dev command line option, cfgstruct.DevFlag(), and cfgstruct.SetupFlag()
This commit is contained in:
parent
773d6a7ad1
commit
66718cc5e6
@ -39,10 +39,9 @@ var (
|
||||
runCfg bootstrap.Config
|
||||
setupCfg bootstrap.Config
|
||||
|
||||
defaultConfDir = fpath.ApplicationDir("storj", "bootstrap")
|
||||
defaultIdentityDir = fpath.ApplicationDir("storj", "identity", "bootstrap")
|
||||
confDir string
|
||||
identityDir string
|
||||
confDir string
|
||||
identityDir string
|
||||
isDev bool
|
||||
)
|
||||
|
||||
const (
|
||||
@ -50,30 +49,15 @@ const (
|
||||
)
|
||||
|
||||
func init() {
|
||||
confDirParam := cfgstruct.FindConfigDirParam()
|
||||
if confDirParam != "" {
|
||||
defaultConfDir = confDirParam
|
||||
}
|
||||
identityDirParam := cfgstruct.FindIdentityDirParam()
|
||||
if identityDirParam != "" {
|
||||
defaultIdentityDir = identityDirParam
|
||||
}
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&confDir, "config-dir", defaultConfDir, "main directory for bootstrap configuration")
|
||||
err := rootCmd.PersistentFlags().SetAnnotation("config-dir", "setup", []string{"true"})
|
||||
if err != nil {
|
||||
zap.S().Error("Failed to set 'setup' annotation for 'config-dir'")
|
||||
}
|
||||
rootCmd.PersistentFlags().StringVar(&identityDir, "identity-dir", defaultIdentityDir, "main directory for bootstrap identity credentials")
|
||||
err = rootCmd.PersistentFlags().SetAnnotation("identity-dir", "setup", []string{"true"})
|
||||
if err != nil {
|
||||
zap.S().Error("Failed to set 'setup' annotation for 'config-dir'")
|
||||
}
|
||||
|
||||
defaultConfDir := fpath.ApplicationDir("storj", "bootstrap")
|
||||
defaultIdentityDir := fpath.ApplicationDir("storj", "identity", "bootstrap")
|
||||
cfgstruct.SetupFlag(zap.L(), rootCmd, &confDir, "config-dir", defaultConfDir, "main directory for bootstrap configuration")
|
||||
cfgstruct.SetupFlag(zap.L(), rootCmd, &identityDir, "identity-dir", defaultIdentityDir, "main directory for bootstrap identity credentials")
|
||||
cfgstruct.DevFlag(rootCmd, &isDev, false, "use development and test configuration settings")
|
||||
rootCmd.AddCommand(runCmd)
|
||||
rootCmd.AddCommand(setupCmd)
|
||||
cfgstruct.Bind(runCmd.Flags(), &runCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(runCmd.Flags(), &runCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
}
|
||||
|
||||
func cmdRun(cmd *cobra.Command, args []string) (err error) {
|
||||
|
@ -47,10 +47,9 @@ var (
|
||||
Overwrite bool `default:"false" help:"if true ca, identity, and authorization db will be overwritten/truncated"`
|
||||
}
|
||||
|
||||
defaultConfDir = fpath.ApplicationDir("storj", "cert-signing")
|
||||
defaultIdentityDir = fpath.ApplicationDir("storj", "identity", "certificates")
|
||||
confDir string
|
||||
identityDir string
|
||||
confDir string
|
||||
identityDir string
|
||||
isDev bool
|
||||
)
|
||||
|
||||
func cmdRun(cmd *cobra.Command, args []string) error {
|
||||
@ -65,21 +64,12 @@ func cmdRun(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
func main() {
|
||||
confDirParam := cfgstruct.FindConfigDirParam()
|
||||
if confDirParam != "" {
|
||||
defaultIdentityDir = confDirParam
|
||||
}
|
||||
identityDirParam := cfgstruct.FindIdentityDirParam()
|
||||
if identityDirParam != "" {
|
||||
defaultIdentityDir = identityDirParam
|
||||
}
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&confDir, "config-dir", defaultConfDir, "main directory for certificates configuration")
|
||||
err := rootCmd.PersistentFlags().SetAnnotation("config-dir", "setup", []string{"true"})
|
||||
if err != nil {
|
||||
zap.S().Error("Failed to set 'setup' annotation for 'config-dir'")
|
||||
}
|
||||
defaultConfDir := fpath.ApplicationDir("storj", "cert-signing")
|
||||
defaultIdentityDir := fpath.ApplicationDir("storj", "identity", "certificates")
|
||||
cfgstruct.SetupFlag(zap.L(), rootCmd, &confDir, "config-dir", defaultConfDir, "main directory for certificates configuration")
|
||||
//cfgstruct.SetupFlag(zap.L(), rootCmd, &identityDir, "identity-dir", fpath.ApplicationDir("storj", "identity", "bootstrap"), "main directory for bootstrap identity credentials")
|
||||
rootCmd.PersistentFlags().StringVar(&identityDir, "identity-dir", defaultIdentityDir, "main directory for storagenode identity credentials")
|
||||
cfgstruct.DevFlag(rootCmd, &isDev, false, "use development and test configuration settings")
|
||||
|
||||
rootCmd.AddCommand(authCmd)
|
||||
rootCmd.AddCommand(runCmd)
|
||||
@ -87,23 +77,21 @@ func main() {
|
||||
rootCmd.AddCommand(signCmd)
|
||||
rootCmd.AddCommand(verifyCmd)
|
||||
rootCmd.AddCommand(claimsCmd)
|
||||
|
||||
claimsCmd.AddCommand(claimsExportCmd)
|
||||
claimsCmd.AddCommand(claimDeleteCmd)
|
||||
|
||||
authCmd.AddCommand(authCreateCmd)
|
||||
authCmd.AddCommand(authInfoCmd)
|
||||
authCmd.AddCommand(authExportCmd)
|
||||
|
||||
cfgstruct.Bind(authCreateCmd.Flags(), &config, cfgstruct.ConfDir(defaultConfDir))
|
||||
cfgstruct.Bind(authInfoCmd.Flags(), &config, cfgstruct.ConfDir(defaultConfDir))
|
||||
cfgstruct.Bind(authExportCmd.Flags(), &config, cfgstruct.ConfDir(defaultConfDir))
|
||||
cfgstruct.Bind(runCmd.Flags(), &config, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &config, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(signCmd.Flags(), &signCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(verifyCmd.Flags(), &verifyCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(claimsExportCmd.Flags(), &claimsExportCfg, cfgstruct.ConfDir(defaultConfDir))
|
||||
cfgstruct.Bind(claimDeleteCmd.Flags(), &claimsDeleteCfg, cfgstruct.ConfDir(defaultConfDir))
|
||||
cfgstruct.Bind(authCreateCmd.Flags(), &config, isDev, cfgstruct.ConfDir(confDir))
|
||||
cfgstruct.Bind(authInfoCmd.Flags(), &config, isDev, cfgstruct.ConfDir(confDir))
|
||||
cfgstruct.Bind(authExportCmd.Flags(), &config, isDev, cfgstruct.ConfDir(confDir))
|
||||
cfgstruct.Bind(runCmd.Flags(), &config, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &config, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.Bind(signCmd.Flags(), &signCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.Bind(verifyCmd.Flags(), &verifyCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.Bind(claimsExportCmd.Flags(), &claimsExportCfg, isDev, cfgstruct.ConfDir(confDir))
|
||||
cfgstruct.Bind(claimDeleteCmd.Flags(), &claimsDeleteCfg, isDev, cfgstruct.ConfDir(confDir))
|
||||
|
||||
process.Exec(rootCmd)
|
||||
}
|
||||
|
@ -59,42 +59,25 @@ var (
|
||||
RunE: cmdRun,
|
||||
}
|
||||
|
||||
defaultConfDir = fpath.ApplicationDir("storj", "gateway")
|
||||
defaultIdentityDir = fpath.ApplicationDir("storj", "identity", "gateway")
|
||||
|
||||
setupCfg GatewayFlags
|
||||
runCfg GatewayFlags
|
||||
|
||||
confDir string
|
||||
identityDir string
|
||||
isDev bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
dirParam := cfgstruct.FindConfigDirParam()
|
||||
if dirParam != "" {
|
||||
defaultConfDir = dirParam
|
||||
}
|
||||
identityDirParam := cfgstruct.FindIdentityDirParam()
|
||||
if identityDirParam != "" {
|
||||
defaultIdentityDir = identityDirParam
|
||||
}
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&confDir, "config-dir", defaultConfDir, "main directory for setup configuration")
|
||||
err := rootCmd.PersistentFlags().SetAnnotation("config-dir", "setup", []string{"true"})
|
||||
if err != nil {
|
||||
zap.S().Error("Failed to set 'setup' annotation for 'config-dir'")
|
||||
}
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&identityDir, "identity-dir", defaultIdentityDir, "main directory for gateway identity credentials")
|
||||
err = rootCmd.PersistentFlags().SetAnnotation("identity-dir", "setup", []string{"true"})
|
||||
if err != nil {
|
||||
zap.S().Error("Failed to set 'setup' annotation for 'config-dir'")
|
||||
}
|
||||
defaultConfDir := fpath.ApplicationDir("storj", "gateway")
|
||||
defaultIdentityDir := fpath.ApplicationDir("storj", "identity", "gateway")
|
||||
cfgstruct.SetupFlag(zap.L(), rootCmd, &confDir, "config-dir", defaultConfDir, "main directory for gateway configuration")
|
||||
cfgstruct.SetupFlag(zap.L(), rootCmd, &identityDir, "identity-dir", defaultIdentityDir, "main directory for gateway identity credentials")
|
||||
cfgstruct.DevFlag(rootCmd, &isDev, false, "use development and test configuration settings")
|
||||
|
||||
rootCmd.AddCommand(runCmd)
|
||||
rootCmd.AddCommand(setupCmd)
|
||||
cfgstruct.Bind(runCmd.Flags(), &runCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(runCmd.Flags(), &runCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
}
|
||||
|
||||
func cmdSetup(cmd *cobra.Command, args []string) (err error) {
|
||||
|
@ -44,11 +44,13 @@ var (
|
||||
Concurrency int `help:"worker concurrency" default:"4"`
|
||||
OutputDir string `help:"output directory to place keys" default:"."`
|
||||
}
|
||||
isDev bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
cfgstruct.DevFlag(rootCmd, &isDev, false, "use development and test configuration settings")
|
||||
rootCmd.AddCommand(keyGenerateCmd)
|
||||
cfgstruct.Bind(keyGenerateCmd.Flags(), &keyCfg)
|
||||
cfgstruct.Bind(keyGenerateCmd.Flags(), &keyCfg, isDev)
|
||||
}
|
||||
|
||||
func cmdKeyGenerate(cmd *cobra.Command, args []string) (err error) {
|
||||
|
@ -106,11 +106,11 @@ func init() {
|
||||
caCmd.AddCommand(revokeCACmd)
|
||||
caCmd.AddCommand(revokePeerCACmd)
|
||||
|
||||
cfgstruct.Bind(newCACmd.Flags(), &newCACfg, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(getIDCmd.Flags(), &getIDCfg, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(caExtCmd.Flags(), &caExtCfg, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(revokeCACmd.Flags(), &revokeCACfg, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(revokePeerCACmd.Flags(), &revokePeerCACfg, cfgstruct.ConfDir(defaultConfigDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(newCACmd.Flags(), &newCACfg, isDev, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(getIDCmd.Flags(), &getIDCfg, isDev, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(caExtCmd.Flags(), &caExtCfg, isDev, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(revokeCACmd.Flags(), &revokeCACfg, isDev, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(revokePeerCACmd.Flags(), &revokePeerCACfg, isDev, cfgstruct.ConfDir(defaultConfigDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
}
|
||||
|
||||
func cmdNewCA(cmd *cobra.Command, args []string) error {
|
||||
|
@ -68,9 +68,9 @@ func init() {
|
||||
idCmd.AddCommand(leafExtCmd)
|
||||
idCmd.AddCommand(revokeLeafCmd)
|
||||
|
||||
cfgstruct.Bind(newIDCmd.Flags(), &newIDCfg, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(leafExtCmd.Flags(), &leafExtCfg, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(revokeLeafCmd.Flags(), &revokeLeafCfg, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(newIDCmd.Flags(), &newIDCfg, isDev, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(leafExtCmd.Flags(), &leafExtCfg, isDev, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(revokeLeafCmd.Flags(), &revokeLeafCfg, isDev, cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
}
|
||||
|
||||
func cmdNewID(cmd *cobra.Command, args []string) (err error) {
|
||||
|
@ -66,8 +66,8 @@ func init() {
|
||||
rootCmd.AddCommand(newServiceCmd)
|
||||
rootCmd.AddCommand(authorizeCmd)
|
||||
|
||||
cfgstruct.Bind(newServiceCmd.Flags(), &config, cfgstruct.ConfDir(defaultConfigDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(authorizeCmd.Flags(), &config, cfgstruct.ConfDir(defaultConfigDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(newServiceCmd.Flags(), &config, isDev, cfgstruct.ConfDir(defaultConfigDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(authorizeCmd.Flags(), &config, isDev, cfgstruct.ConfDir(defaultConfigDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -33,7 +33,7 @@ var (
|
||||
func init() {
|
||||
rootCmd.AddCommand(revocationsCmd)
|
||||
|
||||
cfgstruct.Bind(revocationsCmd.Flags(), &revCfg, cfgstruct.ConfDir(defaultConfigDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(revocationsCmd.Flags(), &revCfg, isDev, cfgstruct.ConfDir(defaultConfigDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
}
|
||||
|
||||
func cmdRevocations(cmd *cobra.Command, args []string) error {
|
||||
|
@ -39,13 +39,15 @@ var (
|
||||
cacheCfg struct {
|
||||
cacheConfig
|
||||
}
|
||||
isDev bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
cfgstruct.DevFlag(rootCmd, &isDev, false, "use development and test configuration settings")
|
||||
rootCmd.AddCommand(addCmd)
|
||||
rootCmd.AddCommand(listCmd)
|
||||
cfgstruct.Bind(addCmd.Flags(), &cacheCfg)
|
||||
cfgstruct.Bind(listCmd.Flags(), &cacheCfg)
|
||||
cfgstruct.Bind(addCmd.Flags(), &cacheCfg, isDev)
|
||||
cfgstruct.Bind(listCmd.Flags(), &cacheCfg, isDev)
|
||||
}
|
||||
|
||||
func cmdList(cmd *cobra.Command, args []string) (err error) {
|
||||
|
@ -81,46 +81,28 @@ var (
|
||||
Database string `help:"satellite database connection string" default:"sqlite3://$CONFDIR/master.db"`
|
||||
Output string `help:"destination of report output" default:""`
|
||||
}
|
||||
|
||||
defaultConfDir = fpath.ApplicationDir("storj", "satellite")
|
||||
// TODO: this path should be defined somewhere else
|
||||
defaultIdentityDir = fpath.ApplicationDir("storj", "identity", "satellite")
|
||||
confDir string
|
||||
identityDir string
|
||||
confDir string
|
||||
identityDir string
|
||||
isDev bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
confDirParam := cfgstruct.FindConfigDirParam()
|
||||
if confDirParam != "" {
|
||||
defaultConfDir = confDirParam
|
||||
}
|
||||
identityDirParam := cfgstruct.FindIdentityDirParam()
|
||||
if identityDirParam != "" {
|
||||
defaultIdentityDir = identityDirParam
|
||||
}
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&confDir, "config-dir", defaultConfDir, "main directory for satellite configuration")
|
||||
err := rootCmd.PersistentFlags().SetAnnotation("config-dir", "setup", []string{"true"})
|
||||
if err != nil {
|
||||
zap.S().Error("Failed to set 'setup' annotation for 'config-dir'")
|
||||
}
|
||||
rootCmd.PersistentFlags().StringVar(&identityDir, "identity-dir", defaultIdentityDir, "main directory for satellite identity credentials")
|
||||
err = rootCmd.PersistentFlags().SetAnnotation("identity-dir", "setup", []string{"true"})
|
||||
if err != nil {
|
||||
zap.S().Error("Failed to set 'setup' annotation for 'config-dir'")
|
||||
}
|
||||
|
||||
defaultConfDir := fpath.ApplicationDir("storj", "satellite")
|
||||
defaultIdentityDir := fpath.ApplicationDir("storj", "identity", "satellite")
|
||||
cfgstruct.SetupFlag(zap.L(), rootCmd, &confDir, "config-dir", defaultConfDir, "main directory for satellite configuration")
|
||||
cfgstruct.SetupFlag(zap.L(), rootCmd, &identityDir, "identity-dir", defaultIdentityDir, "main directory for satellite identity credentials")
|
||||
cfgstruct.DevFlag(rootCmd, &isDev, true, "use development and test configuration settings")
|
||||
rootCmd.AddCommand(runCmd)
|
||||
rootCmd.AddCommand(setupCmd)
|
||||
rootCmd.AddCommand(diagCmd)
|
||||
rootCmd.AddCommand(qdiagCmd)
|
||||
rootCmd.AddCommand(reportsCmd)
|
||||
reportsCmd.AddCommand(nodeUsageCmd)
|
||||
cfgstruct.Bind(runCmd.Flags(), &runCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(diagCmd.Flags(), &diagCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(qdiagCmd.Flags(), &qdiagCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(nodeUsageCmd.Flags(), &nodeUsageCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(runCmd.Flags(), &runCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.Bind(diagCmd.Flags(), &diagCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.Bind(qdiagCmd.Flags(), &qdiagCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.Bind(nodeUsageCmd.Flags(), &nodeUsageCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
}
|
||||
|
||||
func cmdRun(cmd *cobra.Command, args []string) (err error) {
|
||||
|
@ -32,8 +32,9 @@ func main() {
|
||||
Short: "stat receiving",
|
||||
RunE: Main,
|
||||
}
|
||||
|
||||
cfgstruct.Bind(cmd.Flags(), &Config, cfgstruct.ConfDir(defaultConfDir))
|
||||
isDev := false
|
||||
cfgstruct.DevFlag(cmd, &isDev, false, "use development and test configuration settings")
|
||||
cfgstruct.Bind(cmd.Flags(), &Config, isDev, cfgstruct.ConfDir(defaultConfDir))
|
||||
cmd.Flags().String("config", filepath.Join(defaultConfDir, "config.yaml"), "path to configuration")
|
||||
process.Exec(cmd)
|
||||
}
|
||||
|
@ -73,14 +73,11 @@ var (
|
||||
Address string `default:"127.0.0.1:7778" help:"address for dashboard service"`
|
||||
BootstrapAddr string `default:"bootstrap.storj.io:8888" help:"address of server the storage node was bootstrapped against"`
|
||||
}
|
||||
|
||||
defaultConfDir = fpath.ApplicationDir("storj", "storagenode")
|
||||
// TODO: this path should be defined somewhere else
|
||||
defaultIdentityDir = fpath.ApplicationDir("storj", "identity", "storagenode")
|
||||
defaultDiagDir string
|
||||
confDir string
|
||||
identityDir string
|
||||
useColor bool
|
||||
defaultDiagDir string
|
||||
confDir string
|
||||
identityDir string
|
||||
useColor bool
|
||||
isDev bool
|
||||
)
|
||||
|
||||
const (
|
||||
@ -89,38 +86,23 @@ const (
|
||||
)
|
||||
|
||||
func init() {
|
||||
confDirParam := cfgstruct.FindConfigDirParam()
|
||||
if confDirParam != "" {
|
||||
defaultConfDir = confDirParam
|
||||
}
|
||||
identityDirParam := cfgstruct.FindIdentityDirParam()
|
||||
if identityDirParam != "" {
|
||||
defaultIdentityDir = identityDirParam
|
||||
}
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&confDir, "config-dir", defaultConfDir, "main directory for storagenode configuration")
|
||||
err := rootCmd.PersistentFlags().SetAnnotation("config-dir", "setup", []string{"true"})
|
||||
if err != nil {
|
||||
zap.S().Error("Failed to set 'setup' annotation for 'config-dir'")
|
||||
}
|
||||
rootCmd.PersistentFlags().StringVar(&identityDir, "identity-dir", defaultIdentityDir, "main directory for storagenode identity credentials")
|
||||
err = rootCmd.PersistentFlags().SetAnnotation("identity-dir", "setup", []string{"true"})
|
||||
if err != nil {
|
||||
zap.S().Error("Failed to set 'setup' annotation for 'config-dir'")
|
||||
}
|
||||
rootCmd.PersistentFlags().BoolVar(&useColor, "color", false, "use color in user interface")
|
||||
|
||||
defaultConfDir := fpath.ApplicationDir("storj", "storagenode")
|
||||
defaultIdentityDir := fpath.ApplicationDir("storj", "identity", "storagenode")
|
||||
defaultDiagDir = filepath.Join(defaultConfDir, "storage")
|
||||
cfgstruct.SetupFlag(zap.L(), rootCmd, &confDir, "config-dir", defaultConfDir, "main directory for storagenode configuration")
|
||||
cfgstruct.SetupFlag(zap.L(), rootCmd, &identityDir, "identity-dir", defaultIdentityDir, "main directory for storagenode identity credentials")
|
||||
cfgstruct.DevFlag(rootCmd, &isDev, false, "use development and test configuration settings")
|
||||
rootCmd.PersistentFlags().BoolVar(&useColor, "color", false, "use color in user interface")
|
||||
rootCmd.AddCommand(runCmd)
|
||||
rootCmd.AddCommand(setupCmd)
|
||||
rootCmd.AddCommand(configCmd)
|
||||
rootCmd.AddCommand(diagCmd)
|
||||
rootCmd.AddCommand(dashboardCmd)
|
||||
cfgstruct.Bind(runCmd.Flags(), &runCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.BindSetup(configCmd.Flags(), &setupCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(diagCmd.Flags(), &diagCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(dashboardCmd.Flags(), &dashboardCfg, cfgstruct.ConfDir(defaultDiagDir))
|
||||
cfgstruct.Bind(runCmd.Flags(), &runCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.BindSetup(configCmd.Flags(), &setupCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.Bind(diagCmd.Flags(), &diagCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
cfgstruct.Bind(dashboardCmd.Flags(), &dashboardCfg, isDev, cfgstruct.ConfDir(defaultDiagDir))
|
||||
}
|
||||
|
||||
func databaseConfig(config storagenode.Config) storagenodedb.Config {
|
||||
|
@ -19,6 +19,8 @@ type Flags struct {
|
||||
SatelliteCount int
|
||||
StorageNodeCount int
|
||||
Identities int
|
||||
|
||||
IsDev bool
|
||||
}
|
||||
|
||||
var printCommands bool
|
||||
@ -47,6 +49,7 @@ func main() {
|
||||
rootCmd.PersistentFlags().IntVarP(&flags.Identities, "identities", "", 10, "number of identities to create")
|
||||
|
||||
rootCmd.PersistentFlags().BoolVarP(&printCommands, "print-commands", "x", false, "print commands as they are run")
|
||||
rootCmd.PersistentFlags().BoolVarP(&flags.IsDev, "dev", "", false, "use configuration values tuned for development")
|
||||
|
||||
networkCmd := &cobra.Command{
|
||||
Use: "network",
|
||||
|
@ -99,13 +99,12 @@ func networkDestroy(flags *Flags, args []string) error {
|
||||
func newNetwork(flags *Flags) (*Processes, error) {
|
||||
// with common adds all common arguments to the process
|
||||
withCommon := func(all Arguments) Arguments {
|
||||
common := []string{"--metrics.app-suffix", "sim", "--log.level", "debug", "--config-dir", "."}
|
||||
if flags.IsDev {
|
||||
common = append(common, "--dev")
|
||||
}
|
||||
for command, args := range all {
|
||||
all[command] = append([]string{
|
||||
"--metrics.app-suffix", "sim",
|
||||
"--log.level", "debug",
|
||||
"--config-dir", ".",
|
||||
command,
|
||||
}, args...)
|
||||
all[command] = append(append(common, command), args...)
|
||||
}
|
||||
return all
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ type UplinkFlags struct {
|
||||
|
||||
var cfg UplinkFlags
|
||||
|
||||
// RootCmd represents the base CLI command when called without any subcommands
|
||||
//RootCmd represents the base CLI command when called without any subcommands
|
||||
var RootCmd = &cobra.Command{
|
||||
Use: "uplink",
|
||||
Short: "The Storj client-side CLI",
|
||||
@ -50,7 +50,7 @@ func addCmd(cmd *cobra.Command, root *cobra.Command) *cobra.Command {
|
||||
defaultIdentityDir = identityDirParam
|
||||
}
|
||||
|
||||
cfgstruct.Bind(cmd.Flags(), &cfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.Bind(cmd.Flags(), &cfg, isDev, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
@ -23,40 +23,20 @@ var (
|
||||
RunE: cmdSetup,
|
||||
Annotations: map[string]string{"type": "setup"},
|
||||
}
|
||||
|
||||
setupCfg UplinkFlags
|
||||
|
||||
defaultConfDir = fpath.ApplicationDir("storj", "uplink")
|
||||
defaultIdentityDir = fpath.ApplicationDir("storj", "identity", "uplink")
|
||||
|
||||
setupCfg UplinkFlags
|
||||
confDir string
|
||||
identityDir string
|
||||
isDev bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
confDirParam := cfgstruct.FindConfigDirParam()
|
||||
if confDirParam != "" {
|
||||
defaultConfDir = confDirParam
|
||||
}
|
||||
identityDirParam := cfgstruct.FindIdentityDirParam()
|
||||
if identityDirParam != "" {
|
||||
defaultIdentityDir = identityDirParam
|
||||
}
|
||||
|
||||
RootCmd.PersistentFlags().StringVar(&confDir, "config-dir", defaultConfDir, "main directory for setup configuration")
|
||||
err := RootCmd.PersistentFlags().SetAnnotation("config-dir", "setup", []string{"true"})
|
||||
if err != nil {
|
||||
zap.S().Error("Failed to set 'setup' annotation for 'config-dir'")
|
||||
}
|
||||
|
||||
RootCmd.PersistentFlags().StringVar(&identityDir, "identity-dir", defaultIdentityDir, "main directory for uplink identity credentials")
|
||||
err = RootCmd.PersistentFlags().SetAnnotation("identity-dir", "setup", []string{"true"})
|
||||
if err != nil {
|
||||
zap.S().Error("Failed to set 'setup' annotation for 'config-dir'")
|
||||
}
|
||||
|
||||
defaultConfDir := fpath.ApplicationDir("storj", "uplink")
|
||||
defaultIdentityDir := fpath.ApplicationDir("storj", "identity", "uplink")
|
||||
cfgstruct.SetupFlag(zap.L(), RootCmd, &confDir, "config-dir", defaultConfDir, "main directory for uplink configuration")
|
||||
cfgstruct.SetupFlag(zap.L(), RootCmd, &identityDir, "identity-dir", defaultIdentityDir, "main directory for uplink identity credentials")
|
||||
cfgstruct.DevFlag(RootCmd, &isDev, false, "use development and test configuration settings")
|
||||
RootCmd.AddCommand(setupCmd)
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, cfgstruct.ConfDir(defaultConfDir), cfgstruct.IdentityDir(defaultIdentityDir))
|
||||
cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, isDev, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||
}
|
||||
|
||||
func cmdSetup(cmd *cobra.Command, args []string) (err error) {
|
||||
|
@ -22,7 +22,7 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
cfgstruct.Bind(pflag.CommandLine, &identityConfig, cfgstruct.ConfDir("$HOME/.storj/gw"))
|
||||
cfgstruct.Bind(pflag.CommandLine, &identityConfig, true, cfgstruct.ConfDir("$HOME/.storj/gw"))
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -240,6 +240,6 @@ func (uplink *Uplink) getConfig(satellite *satellite.Peer) uplink.Config {
|
||||
|
||||
func getDefaultConfig() uplink.Config {
|
||||
config := uplink.Config{}
|
||||
cfgstruct.Bind(&pflag.FlagSet{}, &config)
|
||||
cfgstruct.Bind(&pflag.FlagSet{}, &config, true)
|
||||
return config
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
|
||||
// Config contains configurable values for rollup
|
||||
type Config struct {
|
||||
Interval time.Duration `help:"how frequently rollup should run" default:"120s"`
|
||||
Interval time.Duration `help:"how frequently rollup should run" devDefault:"120s" default:"6h"`
|
||||
}
|
||||
|
||||
// Rollup is the service for totalling data on storage nodes on daily intervals
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
|
||||
// Config contains configurable values for tally
|
||||
type Config struct {
|
||||
Interval time.Duration `help:"how frequently tally should run" default:"30s"`
|
||||
Interval time.Duration `help:"how frequently tally should run" default:"1h" devDefault:"30s"`
|
||||
}
|
||||
|
||||
// Tally is the service for accounting for data stored on each storage node
|
||||
|
@ -12,7 +12,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"storj.io/storj/internal/memory"
|
||||
)
|
||||
@ -56,18 +58,18 @@ type confVar struct {
|
||||
// Bind sets flags on a FlagSet that match the configuration struct
|
||||
// 'config'. This works by traversing the config struct using the 'reflect'
|
||||
// package. Will ignore fields with `setup:"true"` tag.
|
||||
func Bind(flags FlagSet, config interface{}, opts ...BindOpt) {
|
||||
bind(flags, config, false, opts...)
|
||||
func Bind(flags FlagSet, config interface{}, isDev bool, opts ...BindOpt) {
|
||||
bind(flags, config, false, isDev, opts...)
|
||||
}
|
||||
|
||||
// BindSetup sets flags on a FlagSet that match the configuration struct
|
||||
// 'config'. This works by traversing the config struct using the 'reflect'
|
||||
// package.
|
||||
func BindSetup(flags FlagSet, config interface{}, opts ...BindOpt) {
|
||||
bind(flags, config, true, opts...)
|
||||
func BindSetup(flags FlagSet, config interface{}, isDev bool, opts ...BindOpt) {
|
||||
bind(flags, config, true, isDev, opts...)
|
||||
}
|
||||
|
||||
func bind(flags FlagSet, config interface{}, setupCommand bool, opts ...BindOpt) {
|
||||
func bind(flags FlagSet, config interface{}, setupCommand bool, isDev bool, opts ...BindOpt) {
|
||||
ptrtype := reflect.TypeOf(config)
|
||||
if ptrtype.Kind() != reflect.Ptr {
|
||||
panic(fmt.Sprintf("invalid config type: %#v. Expecting pointer to struct.", config))
|
||||
@ -76,15 +78,15 @@ func bind(flags FlagSet, config interface{}, setupCommand bool, opts ...BindOpt)
|
||||
for _, opt := range opts {
|
||||
opt(vars)
|
||||
}
|
||||
bindConfig(flags, "", reflect.ValueOf(config).Elem(), vars, setupCommand, false)
|
||||
|
||||
bindConfig(flags, "", reflect.ValueOf(config).Elem(), vars, setupCommand, false, isDev)
|
||||
}
|
||||
|
||||
func bindConfig(flags FlagSet, prefix string, val reflect.Value, vars map[string]confVar, setupCommand, setupStruct bool) {
|
||||
func bindConfig(flags FlagSet, prefix string, val reflect.Value, vars map[string]confVar, setupCommand, setupStruct bool, isDev bool) {
|
||||
if val.Kind() != reflect.Struct {
|
||||
panic(fmt.Sprintf("invalid config type: %#v. Expecting struct.", val.Interface()))
|
||||
}
|
||||
typ := val.Type()
|
||||
|
||||
resolvedVars := make(map[string]string, len(vars))
|
||||
{
|
||||
structpath := strings.Replace(prefix, ".", "/", -1)
|
||||
@ -114,19 +116,24 @@ func bindConfig(flags FlagSet, prefix string, val reflect.Value, vars map[string
|
||||
switch field.Type.Kind() {
|
||||
case reflect.Struct:
|
||||
if field.Anonymous {
|
||||
bindConfig(flags, prefix, fieldval, vars, setupCommand, onlyForSetup)
|
||||
bindConfig(flags, prefix, fieldval, vars, setupCommand, onlyForSetup, isDev)
|
||||
} else {
|
||||
bindConfig(flags, flagname+".", fieldval, vars, setupCommand, onlyForSetup)
|
||||
bindConfig(flags, flagname+".", fieldval, vars, setupCommand, onlyForSetup, isDev)
|
||||
}
|
||||
case reflect.Array, reflect.Slice:
|
||||
digits := len(fmt.Sprint(fieldval.Len()))
|
||||
for j := 0; j < fieldval.Len(); j++ {
|
||||
padding := strings.Repeat("0", digits-len(fmt.Sprint(j)))
|
||||
bindConfig(flags, fmt.Sprintf("%s.%s%d.", flagname, padding, j), fieldval.Index(j), vars, setupCommand, onlyForSetup)
|
||||
bindConfig(flags, fmt.Sprintf("%s.%s%d.", flagname, padding, j), fieldval.Index(j), vars, setupCommand, onlyForSetup, isDev)
|
||||
}
|
||||
default:
|
||||
help := field.Tag.Get("help")
|
||||
def := field.Tag.Get("default")
|
||||
if isDev {
|
||||
if devDefault, ok := field.Tag.Lookup("devDefault"); ok {
|
||||
def = devDefault
|
||||
}
|
||||
}
|
||||
fieldaddr := fieldval.Addr().Interface()
|
||||
check := func(err error) {
|
||||
if err != nil {
|
||||
@ -219,3 +226,30 @@ func FindFlagEarly(flagName string) string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
//SetupFlag sets up flags that are needed before `flag.Parse` has been called
|
||||
func SetupFlag(log *zap.Logger, cmd *cobra.Command, dest *string, name, value, usage string) {
|
||||
if foundValue := FindFlagEarly(name); foundValue != "" {
|
||||
value = foundValue
|
||||
}
|
||||
cmd.PersistentFlags().StringVar(dest, name, value, usage)
|
||||
if cmd.PersistentFlags().SetAnnotation(name, "setup", []string{"true"}) != nil {
|
||||
log.Sugar().Errorf("Failed to set 'setup' annotation for '%s'", name)
|
||||
}
|
||||
}
|
||||
|
||||
//DevFlag sets up the dev flag, which is needed before `flag.Parse` has been called
|
||||
func DevFlag(cmd *cobra.Command, dest *bool, value bool, usage string) {
|
||||
for _, arg := range os.Args {
|
||||
if strings.HasPrefix(arg, "--dev=") {
|
||||
if val, err := strconv.ParseBool(strings.TrimPrefix(arg, "--dev=")); err == nil {
|
||||
value = val
|
||||
break
|
||||
}
|
||||
} else if arg == "--dev" {
|
||||
value = true
|
||||
break
|
||||
}
|
||||
}
|
||||
cmd.PersistentFlags().BoolVar(dest, "dev", value, usage)
|
||||
}
|
||||
|
@ -22,22 +22,22 @@ func assertEqual(actual, expected interface{}) {
|
||||
func TestBind(t *testing.T) {
|
||||
f := pflag.NewFlagSet("test", pflag.PanicOnError)
|
||||
var c struct {
|
||||
String string `default:""`
|
||||
Bool bool `default:"false"`
|
||||
Int64 int64 `default:"0"`
|
||||
Int int `default:"0"`
|
||||
Uint64 uint64 `default:"0"`
|
||||
Uint uint `default:"0"`
|
||||
Float64 float64 `default:"0"`
|
||||
Duration time.Duration `default:"0"`
|
||||
String string `default:"" devDefault:"dev"`
|
||||
Bool bool `default:"false" devDefault:"true"`
|
||||
Int64 int64 `default:"0" devDefault:"1"`
|
||||
Int int `default:"0" devDefault:"2"`
|
||||
Uint64 uint64 `default:"0" devDefault:"3"`
|
||||
Uint uint `default:"0" devDefault:"4"`
|
||||
Float64 float64 `default:"0" devDefault:"5.5"`
|
||||
Duration time.Duration `default:"0" devDefault:"1h"`
|
||||
Struct struct {
|
||||
AnotherString string `default:""`
|
||||
AnotherString string `default:"" devDefault:"dev2"`
|
||||
}
|
||||
Fields [10]struct {
|
||||
AnotherInt int `default:"0"`
|
||||
AnotherInt int `default:"0" devDefault:"6"`
|
||||
}
|
||||
}
|
||||
Bind(f, &c)
|
||||
Bind(f, &c, false)
|
||||
|
||||
assertEqual(c.String, string(""))
|
||||
assertEqual(c.Bool, bool(false))
|
||||
@ -88,7 +88,7 @@ func TestConfDir(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Bind(f, &c, ConfDir("confpath"))
|
||||
Bind(f, &c, false, ConfDir("confpath"))
|
||||
assertEqual(f.Lookup("string").DefValue, "-confpath+")
|
||||
assertEqual(f.Lookup("my-struct1.string").DefValue, "1confpath2")
|
||||
assertEqual(f.Lookup("my-struct1.my-struct2.string").DefValue, "2confpath3")
|
||||
@ -105,8 +105,66 @@ func TestNesting(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Bind(f, &c, ConfDirNested("confpath"))
|
||||
Bind(f, &c, false, ConfDirNested("confpath"))
|
||||
assertEqual(f.Lookup("string").DefValue, "-confpath+")
|
||||
assertEqual(f.Lookup("my-struct1.string").DefValue, filepath.FromSlash("1confpath/my-struct12"))
|
||||
assertEqual(f.Lookup("my-struct1.my-struct2.string").DefValue, filepath.FromSlash("2confpath/my-struct1/my-struct23"))
|
||||
}
|
||||
|
||||
func TestBindDevDefaults(t *testing.T) {
|
||||
f := pflag.NewFlagSet("test", pflag.PanicOnError)
|
||||
var c struct {
|
||||
String string `default:"" devDefault:"dev"`
|
||||
Bool bool `default:"false" devDefault:"true"`
|
||||
Int64 int64 `default:"0" devDefault:"1"`
|
||||
Int int `default:"0" devDefault:"2"`
|
||||
Uint64 uint64 `default:"0" devDefault:"3"`
|
||||
Uint uint `default:"0" devDefault:"4"`
|
||||
Float64 float64 `default:"0" devDefault:"5.5"`
|
||||
Duration time.Duration `default:"0" devDefault:"1h"`
|
||||
Struct struct {
|
||||
AnotherString string `default:"" devDefault:"dev2"`
|
||||
}
|
||||
Fields [10]struct {
|
||||
AnotherInt int `default:"0" devDefault:"6"`
|
||||
}
|
||||
}
|
||||
Bind(f, &c, true)
|
||||
|
||||
assertEqual(c.String, string("dev"))
|
||||
assertEqual(c.Bool, bool(true))
|
||||
assertEqual(c.Int64, int64(1))
|
||||
assertEqual(c.Int, int(2))
|
||||
assertEqual(c.Uint64, uint64(3))
|
||||
assertEqual(c.Uint, uint(4))
|
||||
assertEqual(c.Float64, float64(5.5))
|
||||
assertEqual(c.Duration, time.Hour)
|
||||
assertEqual(c.Struct.AnotherString, string("dev2"))
|
||||
assertEqual(c.Fields[0].AnotherInt, int(6))
|
||||
assertEqual(c.Fields[3].AnotherInt, int(6))
|
||||
err := f.Parse([]string{
|
||||
"--string=1",
|
||||
"--bool=true",
|
||||
"--int64=1",
|
||||
"--int=1",
|
||||
"--uint64=1",
|
||||
"--uint=1",
|
||||
"--float64=1",
|
||||
"--duration=1h",
|
||||
"--struct.another-string=1",
|
||||
"--fields.03.another-int=1"})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
assertEqual(c.String, string("1"))
|
||||
assertEqual(c.Bool, bool(true))
|
||||
assertEqual(c.Int64, int64(1))
|
||||
assertEqual(c.Int, int(1))
|
||||
assertEqual(c.Uint64, uint64(1))
|
||||
assertEqual(c.Uint, uint(1))
|
||||
assertEqual(c.Float64, float64(1))
|
||||
assertEqual(c.Duration, time.Hour)
|
||||
assertEqual(c.Struct.AnotherString, string("1"))
|
||||
assertEqual(c.Fields[0].AnotherInt, int(6))
|
||||
assertEqual(c.Fields[3].AnotherInt, int(1))
|
||||
}
|
||||
|
@ -68,9 +68,9 @@ func TestUploadDownload(t *testing.T) {
|
||||
|
||||
// bind default values to config
|
||||
var gwCfg config
|
||||
cfgstruct.Bind(&pflag.FlagSet{}, &gwCfg)
|
||||
cfgstruct.Bind(&pflag.FlagSet{}, &gwCfg, true)
|
||||
var uplinkCfg uplink.Config
|
||||
cfgstruct.Bind(&pflag.FlagSet{}, &uplinkCfg)
|
||||
cfgstruct.Bind(&pflag.FlagSet{}, &uplinkCfg, true)
|
||||
|
||||
// minio config directory
|
||||
gwCfg.Minio.Dir = ctx.Dir("minio")
|
||||
|
Loading…
Reference in New Issue
Block a user