Documentation ¶
Overview ¶
Package confkeys defines all the configuration key alias that configure all the bundled features of mortar. Mortar expects that a `config.yaml` or similar will be loaded as Configuration and exposed via `interfaces/cfg/Config` interface. Mortar will access embedded keys using a `.` (dot) notation.
Example:
Config.Get("mortar.name").String()
*******************************************************************************
Everything related to mortar itself must be under the ROOT key == "mortar"
*******************************************************************************
Expected configuration structure is a map, below is a complete example in the YAML format:
# Root key of everything related to mortar configuration mortar: # Application/Project name # Type: string name: "Application Name" # Web server related configuration server: grpc: # gRPC API External port # Type: int port: 5380 rest: # RESTful API External port # Type: int external: port: 5381 # RESTful API Internal port # Type: int internal: port: 5382 # Default Logger related configuration logger: # Set the default log level for mortar logger # Possible values: # trace, debug, info, warn, error # Type: string level: debug static: # enables/disables adding a git commit SHA in every log entry # Type: bool git: true # enables/disables adding a hostname in every log entry # Type: bool host: false # enables/disables adding an application/project name in every log entry # Type: bool name: false # Metrics/Monitoring related configuration monitor: # sets the namespace/prefix of every metric. Depends on the Metrics implementation # Type: string prefix: "awesome" # allows to include static labels/tags to every published metric # Type: map[string]string tags: tag1: value1 tag2: value2 tag3: value3 # Bundled handlers configuration handlers: config: # defines a list of keywords that once contained within the configuration key will obfuscate the value # Type: []string obfuscate: - "pass" - "auth" - "secret" - "login" - "user" # Interceptors/Extractors configuration middleware: # set the default log level of all the bundled middleware that writes to log # Possible values: # trace, debug, info, warn, error # Type: string logLevel: "trace" # list of headers to be extracted from Incoming gRPC and added to every log entry # Type: []string logHeaders: - "x-forwarded-for" - "special-header" trace: http: client: # include HTTP client request to trace info ? # Type: bool request: true # include HTTP client response to trace info ? # Type: bool response: true grpc: client: # include gRPC client request to trace info ? # Type: bool request: true # include gRPC client response to trace info ? # Type: bool response: true server: # include incoming gRPC request to trace info ? # Type: bool request: true # include a gRPC response of incoming request to trace info ? response: true copy: # list of header prefixes to copy/forward from Incoming gRPC context to outgoing Request context/headers # Type: []string headers: - "authorization"
Index ¶
Constants ¶
const ( // ExternalGRPCPort is the Port on which the webserver will serve gRPC API // // Type: int ExternalGRPCPort string = gRPC + ".port" // ExternalRESTPort is the Port on which the webserver will serve it's external/public RESTful API // // Type: int ExternalRESTPort string = rest + ".external.port" // InternalRESTPort is the Port on which the webserver will serve it's internal/private RESTful API // // Type: int InternalRESTPort string = rest + ".internal.port" )
Webserver related keys
const ( // LogLevel set the default log level for mortar logger // Possible values: // trace, debug, info, warn, error // // Type: string LogLevel string = logger + ".level" // LogIncludeGitSHA enables/disables adding a git commit SHA in every log entry // // Type: bool LogIncludeGitSHA string = logger + ".static.git" // LogIncludeHost enables/disables adding a hostname in every log entry // // Type: bool LogIncludeHost string = logger + ".static.host" // LogIncludeName enables/disables adding an application/project name in every log entry // // Type: bool LogIncludeName string = logger + ".static.name" )
Logger related keys
const ( // MonitorPrefix sets the namespace/prefix of every metric. Depends on the Metrics implementation // // Type: string MonitorPrefix string = monitor + ".prefix" // MonitorTags allows to include static labels/tags to every published metric // // Example: // tags: // tag1: value1 // tag2: value2 // tag3: value3 // // Type: map[string]string MonitorTags string = monitor + ".tags" )
Monitoring related keys
const ( // MiddlewareLogLevel set the default log level of all the bundled middleware that writes to log // Possible values: // trace, debug, info, warn, error // // Type: string MiddlewareLogLevel = middleware + ".logLevel" // HTTPClientTraceIncludeRequest add HTTP client request to trace info ? // // Type: bool HTTPClientTraceIncludeRequest = traceHTTP + ".client.request" // HTTPClientTraceIncludeResponse add HTTP client response to trace info ? // // Type: bool HTTPClientTraceIncludeResponse = traceHTTP + ".client.response" // GRPCClientTraceIncludeRequest add gRPC client request to trace info // // Type: bool GRPCClientTraceIncludeRequest = traceGRPC + ".client.request" // GRPCClientTraceIncludeResponse add gRPC client response to trace info // // Type: bool GRPCClientTraceIncludeResponse = traceGRPC + ".client.response" // GRPCServerTraceIncludeRequest add incoming gRPC request to trace info // // Type: bool GRPCServerTraceIncludeRequest = traceGRPC + ".server.request" // GRPCServerTraceIncludeResponse add a gRPC response of incoming request to trace info // // Type: bool GRPCServerTraceIncludeResponse = traceGRPC + ".server.response" // ForwardIncomingGRPCMetadataHeadersList is a list of header prefixes to copy from Incoming gRPC context to outgoing Request context/headers // // Type: []string ForwardIncomingGRPCMetadataHeadersList = middleware + ".copy.headers" // LoggerIncomingGRPCMetadataHeadersExtractor is a list of headers to be extracted from Incoming gRPC and added to every log entry // // Type: []string LoggerIncomingGRPCMetadataHeadersExtractor = middleware + ".logHeaders" )
Middleware
const ( // ApplicationName is the name of this Application/Project // // Type: string ApplicationName string = mortar + ".name" )
Root level keys
const ( // ConfigHandlerObfuscateKeys defines a list of keywords that once contained within the configuration key will obfuscate the value // // Type: []string ConfigHandlerObfuscateKeys = handlers + ".config.obfuscate" )
Bundled Handlers
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
This section is empty.