github.com/tw-bc-group/fabric-ca@v2.0.0-alpha+incompatible/lib/serverconfig.go (about)

     1  /*
     2  Copyright IBM Corp. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package lib
     8  
     9  import (
    10  	"github.com/hyperledger/fabric-ca/lib/server/operations"
    11  	"github.com/hyperledger/fabric-ca/lib/tls"
    12  )
    13  
    14  const (
    15  	// DefaultServerPort is the default listening port for the fabric-ca server
    16  	DefaultServerPort = 7054
    17  
    18  	// DefaultServerAddr is the default listening address for the fabric-ca server
    19  	DefaultServerAddr = "0.0.0.0"
    20  )
    21  
    22  // ServerConfig is the fabric-ca server's config
    23  // The tags are recognized by the RegisterFlags function in fabric-ca/util/flag.go
    24  // and are as follows:
    25  // "def" - the default value of the field;
    26  // "opt" - the optional one character short name to use on the command line;
    27  // "help" - the help message to display on the command line;
    28  // "skip" - to skip the field.
    29  type ServerConfig struct {
    30  	// Listening port for the server
    31  	Port int `def:"7054" opt:"p" help:"Listening port of fabric-ca-server"`
    32  	// Bind address for the server
    33  	Address string `def:"0.0.0.0" help:"Listening address of fabric-ca-server"`
    34  	// Cross-Origin Resource Sharing settings for the server
    35  	CORS CORS
    36  	// Enables debug logging
    37  	Debug bool `def:"false" opt:"d" help:"Enable debug level logging" hide:"true"`
    38  	// Sets the logging level on the server
    39  	LogLevel string `help:"Set logging level (info, warning, debug, error, fatal, critical)"`
    40  	// TLS for the server's listening endpoint
    41  	TLS tls.ServerTLSConfig
    42  	// Optional client config for an intermediate server which acts as a client
    43  	// of the root (or parent) server
    44  	Client *ClientConfig `skip:"true"`
    45  	// CACfg is the default CA's config
    46  	CAcfg CAConfig `skip:"true"`
    47  	// The names of the CA configuration files
    48  	// This is empty unless there are non-default CAs served by this server
    49  	CAfiles []string `help:"A list of comma-separated CA configuration files"`
    50  	// The number of non-default CAs, which is useful for a dev environment to
    51  	// quickly start any number of CAs in a single server
    52  	CAcount int `def:"0" help:"Number of non-default CA instances"`
    53  	// Size limit of an acceptable CRL in bytes
    54  	CRLSizeLimit int `def:"512000" help:"Size limit of an acceptable CRL in bytes"`
    55  	// CompMode1_3 determines if to run in comptability for version 1.3
    56  	CompMode1_3 bool `skip:"true"`
    57  	// Metrics contains the configuration for provider and statsd
    58  	Metrics operations.MetricsOptions `hide:"true"`
    59  	// Operations contains the configuration for the operations servers
    60  	Operations operations.Options `hide:"true"`
    61  }
    62  
    63  // CORS defines the Cross-Origin Resource Sharing settings for the server.
    64  type CORS struct {
    65  	Enabled bool     `help:"Enable CORS for the fabric-ca-server"`
    66  	Origins []string `help:"Comma-separated list of Access-Control-Allow-Origin domains"`
    67  }