Skip to content

Commit

Permalink
Rename -no-password to -with-password and reverse it's meaning.
Browse files Browse the repository at this point in the history
  • Loading branch information
laodouya authored and laodouya committed May 14, 2019
1 parent 123d4a2 commit 7366b59
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
6 changes: 3 additions & 3 deletions bin/docker-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ blockproducer)
exec /app/cqld -config "${COVENANT_CONF}" -metric-web "${METRIC_WEB_ADDR}" "${@}"
;;
observer)
exec /app/cql explorer -config "${COVENANT_CONF}" -no-password "${COVENANTSQL_OBSERVER_ADDR}" "${@}"
exec /app/cql explorer -config "${COVENANT_CONF}" "${COVENANTSQL_OBSERVER_ADDR}" "${@}"
;;
adapter)
exec /app/cql adapter -config "${COVENANT_CONF}" -no-password "${COVENANTSQL_ADAPTER_ADDR}" "${@}"
exec /app/cql adapter -config "${COVENANT_CONF}" "${COVENANTSQL_ADAPTER_ADDR}" "${@}"
;;
mysql-adapter)
exec /app/cql-mysql-adapter -config "${COVENANT_CONF}" "${@}"
;;
cli)
exec /app/cql console -config ${COVENANT_CONF} -no-password "${@}"
exec /app/cql console -config ${COVENANT_CONF} "${@}"
;;
faucet)
exec /app/cql-faucet -config ${COVENANT_CONF} "${@}"
Expand Down
12 changes: 6 additions & 6 deletions cmd/cql/internal/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
var (
configFile string
password string
noPassword bool
withPassword bool
consoleLogLevel string // foreground console log level

waitTxConfirmation bool // wait for transaction confirmation before exiting
Expand All @@ -56,12 +56,12 @@ var (

func addCommonFlags(cmd *Command) {
cmd.CommonFlag.BoolVar(&help, "help", false, "Show help message")
cmd.CommonFlag.BoolVar(&noPassword, "no-password", true,
"Use empty password for master key")
cmd.CommonFlag.BoolVar(&withPassword, "with-password", false,
"Input passphrase for encrypting private.key")

// debugging flags.
cmd.DebugFlag.StringVar(&password, "password", "",
"Master key password for covenantsql (NOT SAFE, for debug or script only)")
"Passphrase for encrypting private.key (NOT SAFE, for debug or script only)")
cmd.DebugFlag.StringVar(&consoleLogLevel, "log-level", "info",
"Console log level: trace debug info warning error fatal panic")
cmd.DebugFlag.BoolVar(&asymmetric.BypassSignature, "bypass-signature", false,
Expand All @@ -83,14 +83,14 @@ func commonFlagsInit(cmd *Command) {

func addConfigFlag(cmd *Command) {
cmd.CommonFlag.StringVar(&configFile, "config", "~/.cql/config.yaml",
"Config file for covenantsql (Usually no need to set, default is enough.)")
"Config file for CovanantSQL (Usually no need to set, default is enough.)")
}

func configInit() {
configFile = utils.HomeDirExpand(configFile)

if password == "" {
password = readMasterKey(noPassword)
password = readMasterKey(!withPassword)
}

// init covenantsql driver
Expand Down
10 changes: 5 additions & 5 deletions cmd/cql/internal/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ var CmdGenerate = &Command{
Short: "generate a folder contains config file and private key",
Long: `
Generate generates private.key and config.yaml for CovenantSQL.
You can input a passphrase for local encrypt your private key file by set -no-password=false
You can input a passphrase for local encrypt your private key file by set -with-password
e.g.
cql generate
or input a passphrase by
cql generate -no-password=false
cql generate -with-password
`,
}

Expand Down Expand Up @@ -132,7 +132,7 @@ func runGenerate(cmd *Command, args []string) {

if password == "" {
fmt.Println("Please enter the password of the existing private key")
oldPassword = readMasterKey(noPassword)
oldPassword = readMasterKey(!withPassword)
} else {
oldPassword = password
}
Expand Down Expand Up @@ -179,7 +179,7 @@ func runGenerate(cmd *Command, args []string) {
fmt.Println("Generating private key...")
if password == "" {
fmt.Println("Please enter password for new private key")
password = readMasterKey(noPassword)
password = readMasterKey(!withPassword)
}

if privateKeyParam == "" {
Expand Down Expand Up @@ -287,6 +287,6 @@ You can get some free PTC from:
fmt.Println(walletAddr)

if password != "" {
fmt.Println("Your private key had been encrypted by a passphrase, add -no-password=false in any further command")
fmt.Println("Your private key had been encrypted by a passphrase, add -with-password in any further command")
}
}
1 change: 0 additions & 1 deletion sqlchain/mirror/mirror_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ func TestFullProcess(t *testing.T) {
[]string{"-test.coverprofile", FJ(baseDir, "./cmd/cql/mirror.cover.out"),
"mirror",
"-config", FJ(testWorkingDir, "./mirror/node_mirror/config.yaml"),
"-no-password",
"-bg-log-level", "debug",
dsnCfg.DatabaseID,
"127.0.0.1:5663",
Expand Down
2 changes: 0 additions & 2 deletions sqlchain/observer/observation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,6 @@ func TestFullProcess(t *testing.T) {
[]string{"-test.coverprofile", FJ(baseDir, "./cmd/cql/observer.cover.out"),
"explorer",
"-config", FJ(testWorkingDir, "./observation/node_observer/config.yaml"),
"-no-password",
"-bg-log-level", "debug",
"127.0.0.1:4663",
},
Expand Down Expand Up @@ -720,7 +719,6 @@ func TestFullProcess(t *testing.T) {
[]string{"-test.coverprofile", FJ(baseDir, "./cmd/cql/observer.cover.out"),
"explorer",
"-config", FJ(testWorkingDir, "./observation/node_observer/config.yaml"),
"-no-password",
"-bg-log-level", "debug",
"127.0.0.1:4663",
},
Expand Down

0 comments on commit 7366b59

Please sign in to comment.