github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/integration/nwo/templates.go (about)

     1  /*
     2  Copyright hechain. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package nwo
     8  
     9  import "github.com/hechain20/hechain/integration/nwo/template"
    10  
    11  // Templates can be used to provide custom templates to GenerateConfigTree.
    12  type Templates struct {
    13  	ConfigTx string `yaml:"configtx,omitempty"`
    14  	Core     string `yaml:"core,omitempty"`
    15  	Crypto   string `yaml:"crypto,omitempty"`
    16  	Orderer  string `yaml:"orderer,omitempty"`
    17  }
    18  
    19  func (t *Templates) ConfigTxTemplate() string {
    20  	if t.ConfigTx != "" {
    21  		return t.ConfigTx
    22  	}
    23  	return template.DefaultConfigTx
    24  }
    25  
    26  func (t *Templates) CoreTemplate() string {
    27  	if t.Core != "" {
    28  		return t.Core
    29  	}
    30  	return template.DefaultCore
    31  }
    32  
    33  func (t *Templates) CryptoTemplate() string {
    34  	if t.Crypto != "" {
    35  		return t.Crypto
    36  	}
    37  	return template.DefaultCrypto
    38  }
    39  
    40  func (t *Templates) OrdererTemplate() string {
    41  	if t.Orderer != "" {
    42  		return t.Orderer
    43  	}
    44  	return template.DefaultOrderer
    45  }