Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Docs ¶ added in v0.12.0
type Docs struct {
// GenerateOpenAPIDocs will determine if the API documentation (YAML or JSON) will be generated
GenerateOpenAPIDocs bool `yaml:"generate-docs" env:"SIMBA_DOCS_GENERATE" default:"true"`
// MountDocsEndpoint will determine if the documentation UI will be mounted
MountDocsEndpoint bool `yaml:"mount-docs-endpoint" env:"SIMBA_DOCS_MOUNT_ENDPOINT" default:"true"`
// OpenAPIFileType is the type of the OpenAPI file (YAML or JSON)
OpenAPIFileType string `yaml:"open-api-file-type" env:"SIMBA_DOCS_OPENAPI_FILE_TYPE" default:"application/yaml"`
// OpenAPIFilePath is the path to the OpenAPI YAML file
OpenAPIFilePath string `yaml:"open-api-file-path" env:"SIMBA_DOCS_OPENAPI_MOUNT_PATH" default:"/openapi.yml"`
// DocsPath is the path to the API documentation
DocsPath string `yaml:"docs-path" env:"SIMBA_DOCS_MOUNT_PATH" default:"/docs"`
// ServiceName is the name of the service
ServiceName string `yaml:"service-name" env:"SIMBA_DOCS_SERVICE_NAME" default:"Simba Application"`
}
type Option ¶ added in v0.14.0
type Option func(*Simba)
Option is a function that configures a Simba application settings struct.
func WithAllowUnknownFields ¶ added in v0.14.0
WithAllowUnknownFields sets whether to allow unknown fields
func WithLogRequestBody ¶ added in v0.14.0
WithLogRequestBody sets whether to log request bodies
func WithLogger ¶ added in v0.14.0
WithLogger sets the logger
func WithServerHost ¶ added in v0.14.0
WithServerHost sets the server host
func WithServerPort ¶ added in v0.14.0
WithServerPort sets the server port
type Request ¶ added in v0.8.0
type Request struct {
// AllowUnknownFields will set the behavior for unknown fields in the Request body,
// resulting in a 400 Bad Request response if a field is present that cannot be
// mapped to the model struct.
AllowUnknownFields bool `yaml:"allow-unknown-fields" env:"SIMBA_REQUEST_ALLOW_UNKNOWN_FIELDS" default:"true"`
// LogRequestBody will determine if the Request body will be logged
// If set to "disabled", the Request body will not be logged, which is also the default
LogRequestBody bool `yaml:"log-request-body" env:"SIMBA_REQUEST_LOG_REQUEST_BODY" default:"false"`
// RequestIdMode determines how the Request ID will be handled
RequestIdMode simbaModels.RequestIdMode `yaml:"request-id-mode" env:"SIMBA_REQUEST_ID_MODE" default:"AcceptFromHeader"`
}
Request holds the Simba for the Request processing
type Server ¶ added in v0.8.0
type Server struct {
// Host is the host the server will listen on
Host string `yaml:"host" env:"SIMBA_SERVER_HOST" default:"0.0.0.0"`
// Addr is the address the server will listen on
Port int `yaml:"port" env:"SIMBA_SERVER_PORT" default:"9999"`
}
Server holds the Simba for the application server
type Simba ¶ added in v0.14.0
type Simba struct {
// Server settings
Server
// Request settings
Request
// Docs settings
Docs
// Logger settings
Logger *slog.Logger `yaml:"-" env:"-"`
}
Simba is a struct that holds the application settings
func LoadWithOptions ¶ added in v0.14.0
LoadWithOptions loads settings using the options pattern
Click to show internal directories.
Click to hide internal directories.