gitee.com/zhaochuninhefei/fabric-ca-gm@v0.0.2/cmd/fabric-ca-server/main.go (about) 1 /* 2 Copyright IBM Corp. 2017 All Rights Reserved. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package main 18 19 import ( 20 "os" 21 22 "gitee.com/zhaochuninhefei/zcgolog/zclog" 23 ) 24 25 var ( 26 blockingStart = true 27 ) 28 29 // The fabric-ca server main 30 func main() { 31 if err := RunMain(os.Args); err != nil { 32 os.Exit(1) 33 } 34 } 35 36 // RunMain is the fabric-ca server main 37 func RunMain(args []string) error { 38 initZcgolog() 39 // Save the os.Args 40 saveOsArgs := os.Args 41 os.Args = args 42 43 cmdName := "" 44 if len(args) > 1 { 45 cmdName = args[1] 46 } 47 scmd := NewCommand(cmdName, blockingStart) 48 49 // Execute the command 50 err := scmd.Execute() 51 52 // Restore original os.Args 53 os.Args = saveOsArgs 54 55 return err 56 } 57 58 func initZcgolog() { 59 zcgologConf := &zclog.Config{ 60 LogFileDir: "/logs", 61 LogFileNamePrefix: "fabric-ca-server-zcgolog", 62 LogLevelGlobal: zclog.LOG_LEVEL_INFO, 63 LogMod: zclog.LOG_MODE_SERVER, 64 } 65 zclog.InitLogger(zcgologConf) 66 }