-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-1615] Configuration template proto and tool
https://jira.hyperledger.org/browse/FAB-1615 This changeset defines a proto to represent a configuration template. It also defines a tool in the orderer directory to produce this template for the orderer. Change-Id: I3b14a81fcc73a37029f50a9ae0da08e5642d2f4f Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
- Loading branch information
Jason Yellick
committed
Jan 13, 2017
1 parent
c53d2e0
commit ed33fec
Showing
5 changed files
with
142 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
Copyright IBM Corp. 2016 All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"io/ioutil" | ||
|
||
"github.com/hyperledger/fabric/common/flogging" | ||
"github.com/hyperledger/fabric/orderer/common/bootstrap/provisional" | ||
"github.com/hyperledger/fabric/orderer/localconfig" | ||
cb "github.com/hyperledger/fabric/protos/common" | ||
"github.com/hyperledger/fabric/protos/utils" | ||
|
||
logging "github.com/op/go-logging" | ||
) | ||
|
||
var logger = logging.MustGetLogger("orderer/tools/baseconfig") | ||
|
||
const defaultOutputFile = "orderer.template" | ||
|
||
func main() { | ||
var outputFile string | ||
flag.StringVar(&outputFile, "outputFile", defaultOutputFile, "The file to write the configuration templatee to") | ||
flag.Parse() | ||
|
||
conf := config.Load() | ||
flogging.InitFromSpec(conf.General.LogLevel) | ||
|
||
logger.Debugf("Initializing generator") | ||
generator := provisional.New(conf) | ||
|
||
logger.Debugf("Producing template items") | ||
templateItems := generator.TemplateItems() | ||
|
||
logger.Debugf("Encoding configuration template") | ||
outputData := utils.MarshalOrPanic(&cb.ConfigurationTemplate{ | ||
Items: templateItems, | ||
}) | ||
|
||
logger.Debugf("Writing configuration to disk") | ||
ioutil.WriteFile(outputFile, outputData, 0644) | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.