-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e5fcd8
commit e156476
Showing
5 changed files
with
98 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package conf | ||
|
||
import ( | ||
"gopkg.in/urfave/cli.v1" | ||
|
||
"github.com/bnb-chain/greenfield-storage-provider/cmd/utils" | ||
"github.com/bnb-chain/greenfield-storage-provider/config" | ||
) | ||
|
||
var ConfigDumpCmd = cli.Command{ | ||
Action: dumpConfigAction, | ||
Name: "config.dump", | ||
Usage: "Dump default configuration to file for editing", | ||
Category: "CONFIG COMMANDS", | ||
Description: ` | ||
The config.dump command writes default configuration | ||
values to ./config.toml file for editing.`, | ||
} | ||
|
||
// dumpConfigAction is the dump.config command. | ||
func dumpConfigAction(ctx *cli.Context) error { | ||
return config.SaveConfig("./config.toml", config.DefaultStorageProviderConfig) | ||
} | ||
|
||
var ConfigUploadCmd = cli.Command{ | ||
Action: configUploadAction, | ||
Name: "config.upload", | ||
Usage: "Upload the config file to db", | ||
Flags: []cli.Flag{ | ||
utils.ConfigFileFlag, | ||
utils.DBUserFlag, | ||
utils.DBPasswordFlag, | ||
}, | ||
Category: "CONFIG COMMANDS", | ||
Description: ` | ||
The config.upload command upload the file to db for sp to load`, | ||
} | ||
|
||
// configUploadAction is the config.upload command. | ||
func configUploadAction(ctx *cli.Context) error { | ||
//var configFile string | ||
//if ctx.GlobalIsSet(utils.ConfigFileFlag.Name) { | ||
// configFile = ctx.GlobalString(utils.ConfigFileFlag.Name) | ||
//} else { | ||
// configFile = "./config.toml" | ||
//} | ||
//cfg := config.LoadConfig(configFile) | ||
|
||
// TODO:: new sp db, and upload | ||
// replace by env vars | ||
return nil | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package utils | ||
|
||
import ( | ||
"gopkg.in/urfave/cli.v1" | ||
|
||
"github.com/bnb-chain/greenfield-storage-provider/model" | ||
) | ||
|
||
var ( | ||
VersionFlag = cli.BoolFlag{ | ||
Name: "version", | ||
Usage: "Show the storage provider version information", | ||
} | ||
ConfigFileFlag = cli.StringFlag{ | ||
Name: "config", | ||
Usage: "Config file path for uploading to db", | ||
Value: "./config.toml", | ||
} | ||
DBUserFlag = cli.StringFlag{ | ||
Name: "user", | ||
Usage: "DB user name", | ||
EnvVar: model.SpDBUser, | ||
} | ||
DBPasswordFlag = cli.StringFlag{ | ||
Name: "password", | ||
Usage: "DB password", | ||
EnvVar: model.SpDBPasswd, | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package utils | ||
|
||
import "testing" | ||
|
||
func Test_EnvFlag(t *testing.T) { | ||
|
||
} |