ceremonyclient/client/cmd/node/nodeconfig/utils.go
Tyler Sturos 9cfbdef12c
Feat/2.1 qclient refactor and node install (#429)
* 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>
2025-04-11 21:43:20 -05:00

43 lines
834 B
Go

package nodeconfig
import (
"os"
"path/filepath"
)
// HasConfigFiles checks if a directory contains both config.yml and keys.yml files
func HasConfigFiles(dirPath string) bool {
configPath := filepath.Join(dirPath, "config.yml")
keysPath := filepath.Join(dirPath, "keys.yml")
// Check if both files exist
configExists := false
keysExists := false
if _, err := os.Stat(configPath); !os.IsNotExist(err) {
configExists = true
}
if _, err := os.Stat(keysPath); !os.IsNotExist(err) {
keysExists = true
}
return configExists && keysExists
}
func ListConfigurations() ([]string, error) {
files, err := os.ReadDir(ConfigDirs)
if err != nil {
return nil, err
}
configs := make([]string, 0)
for _, file := range files {
if file.IsDir() {
configs = append(configs, file.Name())
}
}
return configs, nil
}