@@ -274,7 +274,7 @@ func (c *Config) loadTemplateConfig() error {
274274 }
275275
276276 // if set, use it to load default config
277- c .configViper .AddConfigPath (substPathVars (templatePath ))
277+ c .configViper .AddConfigPath (SubstPathVars (templatePath ))
278278 err := c .configViper .ReadInConfig () // Find and read the config file
279279 if err != nil { // Handle errors reading the config file
280280 return errors .Wrap (err , "loading config file failed" )
@@ -290,9 +290,9 @@ func (c *Config) Client() (*core.ClientConfig, error) {
290290 }
291291 client := config .Client
292292
293- client .TLSCerts .Path = substPathVars (client .TLSCerts .Path )
294- client .TLSCerts .Client .Key .Path = substPathVars (client .TLSCerts .Client .Key .Path )
295- client .TLSCerts .Client .Cert .Path = substPathVars (client .TLSCerts .Client .Cert .Path )
293+ client .TLSCerts .Path = SubstPathVars (client .TLSCerts .Path )
294+ client .TLSCerts .Client .Key .Path = SubstPathVars (client .TLSCerts .Client .Key .Path )
295+ client .TLSCerts .Client .Cert .Path = SubstPathVars (client .TLSCerts .Client .Cert .Path )
296296
297297 return & client , nil
298298}
@@ -355,7 +355,7 @@ func (c *Config) CAServerCertPaths(org string) ([]string, error) {
355355
356356 certFileModPath := make ([]string , len (certFiles ))
357357 for i , v := range certFiles {
358- certFileModPath [i ] = substPathVars (v )
358+ certFileModPath [i ] = SubstPathVars (v )
359359 }
360360
361361 return certFileModPath , nil
@@ -396,7 +396,7 @@ func (c *Config) CAClientKeyPath(org string) (string, error) {
396396 if _ , ok := config .CertificateAuthorities [strings .ToLower (caName )]; ! ok {
397397 return "" , errors .Errorf ("CA Server Name '%s' not found" , caName )
398398 }
399- return substPathVars (config .CertificateAuthorities [strings .ToLower (caName )].TLSCACerts .Client .Key .Path ), nil
399+ return SubstPathVars (config .CertificateAuthorities [strings .ToLower (caName )].TLSCACerts .Client .Key .Path ), nil
400400}
401401
402402// CAClientKeyPem Read configuration option for the fabric CA client key pem embedded in the client config
@@ -436,7 +436,7 @@ func (c *Config) CAClientCertPath(org string) (string, error) {
436436 if _ , ok := config .CertificateAuthorities [strings .ToLower (caName )]; ! ok {
437437 return "" , errors .Errorf ("CA Server Name '%s' not found" , caName )
438438 }
439- return substPathVars (config .CertificateAuthorities [strings .ToLower (caName )].TLSCACerts .Client .Cert .Path ), nil
439+ return SubstPathVars (config .CertificateAuthorities [strings .ToLower (caName )].TLSCACerts .Client .Cert .Path ), nil
440440}
441441
442442// CAClientCertPem Read configuration option for the fabric CA client cert pem embedded in the client config
@@ -603,7 +603,7 @@ func (c *Config) OrderersConfig() ([]core.OrdererConfig, error) {
603603 for _ , orderer := range config .Orderers {
604604
605605 if orderer .TLSCACerts .Path != "" {
606- orderer .TLSCACerts .Path = substPathVars (orderer .TLSCACerts .Path )
606+ orderer .TLSCACerts .Path = SubstPathVars (orderer .TLSCACerts .Path )
607607 } else if len (orderer .TLSCACerts .Pem ) == 0 && c .configViper .GetBool ("client.tlsCerts.systemCertPool" ) == false {
608608 errors .Errorf ("Orderer has no certs configured. Make sure TLSCACerts.Pem or TLSCACerts.Path is set for %s" , orderer .URL )
609609 }
@@ -650,7 +650,7 @@ func (c *Config) OrdererConfig(name string) (*core.OrdererConfig, error) {
650650 }
651651
652652 if orderer .TLSCACerts .Path != "" {
653- orderer .TLSCACerts .Path = substPathVars (orderer .TLSCACerts .Path )
653+ orderer .TLSCACerts .Path = SubstPathVars (orderer .TLSCACerts .Path )
654654 }
655655
656656 return & orderer , nil
@@ -677,7 +677,7 @@ func (c *Config) PeersConfig(org string) ([]core.PeerConfig, error) {
677677 p = * matchingPeerConfig
678678 }
679679 if p .TLSCACerts .Path != "" {
680- p .TLSCACerts .Path = substPathVars (p .TLSCACerts .Path )
680+ p .TLSCACerts .Path = SubstPathVars (p .TLSCACerts .Path )
681681 }
682682
683683 peers = append (peers , p )
@@ -962,7 +962,7 @@ func (c *Config) PeerConfig(org string, name string) (*core.PeerConfig, error) {
962962 }
963963
964964 if peerConfig .TLSCACerts .Path != "" {
965- peerConfig .TLSCACerts .Path = substPathVars (peerConfig .TLSCACerts .Path )
965+ peerConfig .TLSCACerts .Path = SubstPathVars (peerConfig .TLSCACerts .Path )
966966 }
967967 return & peerConfig , nil
968968}
@@ -983,7 +983,7 @@ func (c *Config) peerConfig(name string) (*core.PeerConfig, error) {
983983 }
984984
985985 if peerConfig .TLSCACerts .Path != "" {
986- peerConfig .TLSCACerts .Path = substPathVars (peerConfig .TLSCACerts .Path )
986+ peerConfig .TLSCACerts .Path = SubstPathVars (peerConfig .TLSCACerts .Path )
987987 }
988988 return & peerConfig , nil
989989}
@@ -1068,7 +1068,7 @@ func (c *Config) ChannelPeers(name string) ([]core.ChannelPeer, error) {
10681068 }
10691069
10701070 if p .TLSCACerts .Path != "" {
1071- p .TLSCACerts .Path = substPathVars (p .TLSCACerts .Path )
1071+ p .TLSCACerts .Path = SubstPathVars (p .TLSCACerts .Path )
10721072 }
10731073
10741074 mspID , err := c .PeerMspID (peerName )
@@ -1103,7 +1103,7 @@ func (c *Config) NetworkPeers() ([]core.NetworkPeer, error) {
11031103 }
11041104
11051105 if p .TLSCACerts .Path != "" {
1106- p .TLSCACerts .Path = substPathVars (p .TLSCACerts .Path )
1106+ p .TLSCACerts .Path = SubstPathVars (p .TLSCACerts .Path )
11071107 }
11081108
11091109 mspID , err := c .PeerMspID (name )
@@ -1244,25 +1244,25 @@ func (c *Config) SecurityProviderLabel() string {
12441244
12451245// CredentialStorePath returns the user store path
12461246func (c * Config ) CredentialStorePath () string {
1247- return substPathVars (c .configViper .GetString ("client.credentialStore.path" ))
1247+ return SubstPathVars (c .configViper .GetString ("client.credentialStore.path" ))
12481248}
12491249
12501250// KeyStorePath returns the keystore path used by BCCSP
12511251func (c * Config ) KeyStorePath () string {
1252- keystorePath := substPathVars (c .configViper .GetString ("client.credentialStore.cryptoStore.path" ))
1252+ keystorePath := SubstPathVars (c .configViper .GetString ("client.credentialStore.cryptoStore.path" ))
12531253 return path .Join (keystorePath , "keystore" )
12541254}
12551255
12561256// CAKeyStorePath returns the same path as KeyStorePath() without the
12571257// 'keystore' directory added. This is done because the fabric-ca-client
12581258// adds this to the path
12591259func (c * Config ) CAKeyStorePath () string {
1260- return substPathVars (c .configViper .GetString ("client.credentialStore.cryptoStore.path" ))
1260+ return SubstPathVars (c .configViper .GetString ("client.credentialStore.cryptoStore.path" ))
12611261}
12621262
12631263// CryptoConfigPath ...
12641264func (c * Config ) CryptoConfigPath () string {
1265- return substPathVars (c .configViper .GetString ("client.cryptoconfig.path" ))
1265+ return SubstPathVars (c .configViper .GetString ("client.cryptoconfig.path" ))
12661266}
12671267
12681268// TLSClientCerts loads the client's certs for mutual TLS
@@ -1323,11 +1323,11 @@ func loadByteKeyOrCertFromFile(c *core.ClientConfig, isKey bool) ([]byte, error)
13231323 var path string
13241324 a := "key"
13251325 if isKey {
1326- path = substPathVars (c .TLSCerts .Client .Key .Path )
1326+ path = SubstPathVars (c .TLSCerts .Client .Key .Path )
13271327 c .TLSCerts .Client .Key .Path = path
13281328 } else {
13291329 a = "cert"
1330- path = substPathVars (c .TLSCerts .Client .Cert .Path )
1330+ path = SubstPathVars (c .TLSCerts .Client .Cert .Path )
13311331 c .TLSCerts .Client .Cert .Path = path
13321332 }
13331333 bts , err := ioutil .ReadFile (path )
0 commit comments