mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-03-03 23:37:27 +08:00
* initial auto-update * working link, update, and testing docker container and scripts * refactor packages/folders * move files to proper folders * fix typos Closes #421 * optimize rpm imports * optimize channel imports * Refactor split command to allow testing of split operations Closes #338 * modify split and test for folder changes * remove alias * fix docker warning about FROM and AS being in different letter case Closes #422 * QClient Account Command * Display transaction details and confirmation prompts for transfer and merge commands * build qclient docker improvements * update build args for mpfr.so.6 * update install and node commands * remove NodeConfig check for qclient node commands * udpate * working node commands * update commands * move utils and rename package --------- Co-authored-by: Vasyl Tretiakov <vasyl.tretiakov@gmail.com> Co-authored-by: littleblackcloud <163544315+littleblackcloud@users.noreply.github.com> Co-authored-by: 0xOzgur <29779769+0xOzgur@users.noreply.github.com> Co-authored-by: Cassandra Heart <7929478+CassOnMars@users.noreply.github.com>
61 lines
1.5 KiB
Go
61 lines
1.5 KiB
Go
package nodeconfig
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/user"
|
|
"path/filepath"
|
|
|
|
"github.com/spf13/cobra"
|
|
"source.quilibrium.com/quilibrium/monorepo/client/utils"
|
|
)
|
|
|
|
var (
|
|
NodeUser *user.User
|
|
ConfigDirs string
|
|
NodeConfigToRun string
|
|
SetDefault bool
|
|
)
|
|
|
|
// ConfigCmd represents the node config command
|
|
var ConfigCmd = &cobra.Command{
|
|
Use: "config",
|
|
Short: "Manage node configuration",
|
|
Long: `Manage Quilibrium node configuration.
|
|
|
|
This command provides utilities for configuring your Quilibrium node, such as:
|
|
- Setting configuration values
|
|
- Setting default configuration
|
|
- Creating default configuration
|
|
- Importing configuration
|
|
`,
|
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
|
// Check if the config directory exists
|
|
user, err := utils.GetCurrentSudoUser()
|
|
if err != nil {
|
|
fmt.Println("Error getting current user:", err)
|
|
os.Exit(1)
|
|
}
|
|
ConfigDirs = filepath.Join(user.HomeDir, ".quilibrium", "configs")
|
|
NodeConfigToRun = filepath.Join(user.HomeDir, ".quilibrium", "configs", "default")
|
|
if utils.FileExists(ConfigDirs) {
|
|
utils.ValidateAndCreateDir(ConfigDirs, user)
|
|
}
|
|
},
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
cmd.Help()
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
importCmd.Flags().BoolVarP(&SetDefault, "default", "d", false, "Select this config as the default")
|
|
ConfigCmd.AddCommand(importCmd)
|
|
|
|
ConfigCmd.AddCommand(SwitchConfigCmd)
|
|
|
|
createCmd.Flags().BoolVarP(&SetDefault, "default", "d", false, "Select this config as the default")
|
|
ConfigCmd.AddCommand(createCmd)
|
|
ConfigCmd.AddCommand(setCmd)
|
|
|
|
}
|