Skip to content
Snippets Groups Projects
Commit 9e2fe243 authored by Josh Brooks's avatar Josh Brooks
Browse files

Merge branch 'hotfix/SetLegacyFlag' into 'release'

Hotfix/set legacy flag

See merge request !343
parents e7736fde ce75d9cd
No related branches found
No related tags found
2 merge requests!510Release,!343Hotfix/set legacy flag
...@@ -82,6 +82,7 @@ const ( ...@@ -82,6 +82,7 @@ const (
profileCpuFlag = "profile-cpu" profileCpuFlag = "profile-cpu"
profileMemFlag = "profile-mem" profileMemFlag = "profile-mem"
userIdPrefixFlag = "userid-prefix" userIdPrefixFlag = "userid-prefix"
legacyFlag = "legacy"
///////////////// Broadcast subcommand flags ////////////////////////////// ///////////////// Broadcast subcommand flags //////////////////////////////
broadcastNameFlag = "name" broadcastNameFlag = "name"
......
...@@ -45,16 +45,27 @@ var initCmd = &cobra.Command{ ...@@ -45,16 +45,27 @@ var initCmd = &cobra.Command{
jww.FATAL.Panicf("%+v", err) jww.FATAL.Panicf("%+v", err)
} }
identity, err := xxdk.MakeReceptionIdentity(net) // Generate identity
var identity xxdk.ReceptionIdentity
if viper.GetBool(legacyFlag) {
identity, err = xxdk.MakeLegacyReceptionIdentity(net)
} else {
identity, err = xxdk.MakeReceptionIdentity(net)
}
// Panic if conditional branch fails
if err != nil { if err != nil {
jww.FATAL.Panicf("%+v", err) jww.FATAL.Panicf("%+v", err)
} }
// Store identity
err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, net) err = xxdk.StoreReceptionIdentity(identityStorageKey, identity, net)
if err != nil { if err != nil {
jww.FATAL.Panicf("%+v", err) jww.FATAL.Panicf("%+v", err)
} }
// Write contact to file
jww.INFO.Printf("User: %s", identity.ID) jww.INFO.Printf("User: %s", identity.ID)
writeContact(identity.GetContact()) writeContact(identity.GetContact())
...@@ -68,6 +79,11 @@ func init() { ...@@ -68,6 +79,11 @@ func init() {
"Desired prefix of userID to brute force when running init command. Prepend (?i) for case-insensitive. Only Base64 characters are valid.") "Desired prefix of userID to brute force when running init command. Prepend (?i) for case-insensitive. Only Base64 characters are valid.")
bindFlagHelper(userIdPrefixFlag, initCmd) bindFlagHelper(userIdPrefixFlag, initCmd)
initCmd.Flags().BoolP(legacyFlag, "", false,
"Generates a legacy identity if set. "+
"If this flag is absent, a standard identity will be generated.")
bindFlagHelper(legacyFlag, initCmd)
rootCmd.AddCommand(initCmd) rootCmd.AddCommand(initCmd)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment