@@ -106,7 +106,7 @@ func getConsensusConfig(v *viper.Viper) snowball.Parameters {
106
106
107
107
func getLoggingConfig (v * viper.Viper ) (logging.Config , error ) {
108
108
loggingConfig := logging.Config {}
109
- loggingConfig .Directory = GetExpandedArg (v , LogsDirKey )
109
+ loggingConfig .Directory = getExpandedArg (v , LogsDirKey )
110
110
var err error
111
111
loggingConfig .LogLevel , err = logging .ToLevel (v .GetString (LogLevelKey ))
112
112
if err != nil {
@@ -144,7 +144,7 @@ func getHTTPConfig(v *viper.Viper) (node.HTTPConfig, error) {
144
144
return node.HTTPConfig {}, fmt .Errorf ("unable to decode base64 content: %w" , err )
145
145
}
146
146
case v .IsSet (HTTPSKeyFileKey ):
147
- httpsKeyFilepath := GetExpandedArg (v , HTTPSKeyFileKey )
147
+ httpsKeyFilepath := getExpandedArg (v , HTTPSKeyFileKey )
148
148
httpsKey , err = os .ReadFile (filepath .Clean (httpsKeyFilepath ))
149
149
if err != nil {
150
150
return node.HTTPConfig {}, err
@@ -159,7 +159,7 @@ func getHTTPConfig(v *viper.Viper) (node.HTTPConfig, error) {
159
159
return node.HTTPConfig {}, fmt .Errorf ("unable to decode base64 content: %w" , err )
160
160
}
161
161
case v .IsSet (HTTPSCertFileKey ):
162
- httpsCertFilepath := GetExpandedArg (v , HTTPSCertFileKey )
162
+ httpsCertFilepath := getExpandedArg (v , HTTPSCertFileKey )
163
163
httpsCert , err = os .ReadFile (filepath .Clean (httpsCertFilepath ))
164
164
if err != nil {
165
165
return node.HTTPConfig {}, err
@@ -558,7 +558,7 @@ func getIPConfig(v *viper.Viper) (node.IPConfig, error) {
558
558
559
559
func getProfilerConfig (v * viper.Viper ) (profiler.Config , error ) {
560
560
config := profiler.Config {
561
- Dir : GetExpandedArg (v , ProfileDirKey ),
561
+ Dir : getExpandedArg (v , ProfileDirKey ),
562
562
Enabled : v .GetBool (ProfileContinuousEnabledKey ),
563
563
Freq : v .GetDuration (ProfileContinuousFreqKey ),
564
564
MaxNumFiles : v .GetInt (ProfileContinuousMaxFilesKey ),
@@ -592,8 +592,8 @@ func getStakingTLSCertFromFlag(v *viper.Viper) (tls.Certificate, error) {
592
592
593
593
func getStakingTLSCertFromFile (v * viper.Viper ) (tls.Certificate , error ) {
594
594
// Parse the staking key/cert paths and expand environment variables
595
- stakingKeyPath := GetExpandedArg (v , StakingTLSKeyPathKey )
596
- stakingCertPath := GetExpandedArg (v , StakingCertPathKey )
595
+ stakingKeyPath := getExpandedArg (v , StakingTLSKeyPathKey )
596
+ stakingCertPath := getExpandedArg (v , StakingCertPathKey )
597
597
598
598
// If staking key/cert locations are specified but not found, error
599
599
if v .IsSet (StakingTLSKeyPathKey ) || v .IsSet (StakingCertPathKey ) {
@@ -661,7 +661,7 @@ func getStakingSigner(v *viper.Viper) (bls.Signer, error) {
661
661
return key , nil
662
662
}
663
663
664
- signingKeyPath := GetExpandedArg (v , StakingSignerKeyPathKey )
664
+ signingKeyPath := getExpandedArg (v , StakingSignerKeyPathKey )
665
665
_ , err := os .Stat (signingKeyPath )
666
666
if ! errors .Is (err , fs .ErrNotExist ) {
667
667
signingKeyBytes , err := os .ReadFile (signingKeyPath )
@@ -703,9 +703,9 @@ func getStakingConfig(v *viper.Viper, networkID uint32) (node.StakingConfig, err
703
703
SybilProtectionEnabled : v .GetBool (SybilProtectionEnabledKey ),
704
704
SybilProtectionDisabledWeight : v .GetUint64 (SybilProtectionDisabledWeightKey ),
705
705
PartialSyncPrimaryNetwork : v .GetBool (PartialSyncPrimaryNetworkKey ),
706
- StakingKeyPath : GetExpandedArg (v , StakingTLSKeyPathKey ),
707
- StakingCertPath : GetExpandedArg (v , StakingCertPathKey ),
708
- StakingSignerPath : GetExpandedArg (v , StakingSignerKeyPathKey ),
706
+ StakingKeyPath : getExpandedArg (v , StakingTLSKeyPathKey ),
707
+ StakingCertPath : getExpandedArg (v , StakingCertPathKey ),
708
+ StakingSignerPath : getExpandedArg (v , StakingSignerKeyPathKey ),
709
709
}
710
710
if ! config .SybilProtectionEnabled && config .SybilProtectionDisabledWeight == 0 {
711
711
return node.StakingConfig {}, errSybilProtectionDisabledStakerWeights
@@ -807,7 +807,7 @@ func getUpgradeConfig(v *viper.Viper, networkID uint32) (upgrade.Config, error)
807
807
)
808
808
switch {
809
809
case v .IsSet (UpgradeFileKey ):
810
- upgradeFileName := GetExpandedArg (v , UpgradeFileKey )
810
+ upgradeFileName := getExpandedArg (v , UpgradeFileKey )
811
811
upgradeBytes , err = os .ReadFile (upgradeFileName )
812
812
if err != nil {
813
813
return upgrade.Config {}, fmt .Errorf ("unable to read upgrade file: %w" , err )
@@ -836,7 +836,7 @@ func getGenesisData(v *viper.Viper, networkID uint32, stakingCfg *genesis.Stakin
836
836
837
837
// if content is not specified go for the file
838
838
if v .IsSet (GenesisFileKey ) {
839
- genesisFileName := GetExpandedArg (v , GenesisFileKey )
839
+ genesisFileName := getExpandedArg (v , GenesisFileKey )
840
840
return genesis .FromFile (networkID , genesisFileName , stakingCfg )
841
841
}
842
842
@@ -877,7 +877,7 @@ func getDatabaseConfig(v *viper.Viper, networkID uint32) (node.DatabaseConfig, e
877
877
return node.DatabaseConfig {}, fmt .Errorf ("unable to decode base64 content: %w" , err )
878
878
}
879
879
} else if v .IsSet (DBConfigFileKey ) {
880
- path := GetExpandedArg (v , DBConfigFileKey )
880
+ path := getExpandedArg (v , DBConfigFileKey )
881
881
configBytes , err = os .ReadFile (path )
882
882
if err != nil {
883
883
return node.DatabaseConfig {}, err
@@ -888,7 +888,7 @@ func getDatabaseConfig(v *viper.Viper, networkID uint32) (node.DatabaseConfig, e
888
888
Name : v .GetString (DBTypeKey ),
889
889
ReadOnly : v .GetBool (DBReadOnlyKey ),
890
890
Path : filepath .Join (
891
- GetExpandedArg (v , DBPathKey ),
891
+ getExpandedArg (v , DBPathKey ),
892
892
constants .NetworkName (networkID ),
893
893
),
894
894
Config : configBytes ,
@@ -905,7 +905,7 @@ func getAliases(v *viper.Viper, name string, contentKey string, fileKey string)
905
905
return nil , fmt .Errorf ("unable to decode base64 content for %s: %w" , name , err )
906
906
}
907
907
} else {
908
- aliasFilePath := filepath .Clean (GetExpandedArg (v , fileKey ))
908
+ aliasFilePath := filepath .Clean (getExpandedArg (v , fileKey ))
909
909
exists , err := storage .FileExists (aliasFilePath )
910
910
if err != nil {
911
911
return nil , err
@@ -941,7 +941,7 @@ func getChainAliases(v *viper.Viper) (map[ids.ID][]string, error) {
941
941
942
942
// getPathFromDirKey reads flag value from viper instance and then checks the folder existence
943
943
func getPathFromDirKey (v * viper.Viper , configKey string ) (string , error ) {
944
- configDir := GetExpandedArg (v , configKey )
944
+ configDir := getExpandedArg (v , configKey )
945
945
cleanPath := filepath .Clean (configDir )
946
946
ok , err := storage .FolderExists (cleanPath )
947
947
if err != nil {
@@ -1223,7 +1223,7 @@ func getTraceConfig(v *viper.Viper) (trace.Config, error) {
1223
1223
1224
1224
// Returns the path to the directory that contains VM binaries.
1225
1225
func getPluginDir (v * viper.Viper ) (string , error ) {
1226
- pluginDir := GetExpandedString (v , v . GetString ( PluginDirKey ) )
1226
+ pluginDir := getExpandedArg (v , PluginDirKey )
1227
1227
1228
1228
if v .IsSet (PluginDirKey ) {
1229
1229
// If the flag was given, assert it exists and is a directory
@@ -1452,9 +1452,9 @@ func GetNodeConfig(v *viper.Viper) (node.Config, error) {
1452
1452
return node.Config {}, err
1453
1453
}
1454
1454
1455
- nodeConfig .ChainDataDir = GetExpandedArg (v , ChainDataDirKey )
1455
+ nodeConfig .ChainDataDir = getExpandedArg (v , ChainDataDirKey )
1456
1456
1457
- nodeConfig .ProcessContextFilePath = GetExpandedArg (v , ProcessContextFileKey )
1457
+ nodeConfig .ProcessContextFilePath = getExpandedArg (v , ProcessContextFileKey )
1458
1458
1459
1459
nodeConfig .ProvidedFlags = providedFlags (v )
1460
1460
return nodeConfig , nil
0 commit comments