Documentation
¶
Index ¶
- type Application
- type Docs
- type Option
- func WithAllowUnknownFields(allow bool) Option
- func WithApplicationName(name string) Option
- func WithApplicationVersion(version string) Option
- func WithDocsUIPath(path string) Option
- func WithEnvGetter(getter func(string) string) Option
- func WithGenerateOpenAPIDocs(generate bool) Option
- func WithLogRequestBody(log bool) Option
- func WithLogger(logger *slog.Logger) Option
- func WithMountDocsUIEndpoint(mount bool) Option
- func WithOpenAPIFilePath(path string) Option
- func WithRequestIdMode(mode simbaModels.RequestIdMode) Option
- func WithServerHost(host string) Option
- func WithServerPort(port int) Option
- type Request
- type Server
- type Simba
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶ added in v0.16.0
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"` // MountDocsUIEndpoint will determine if the documentation UI will be mounted MountDocsUIEndpoint bool `yaml:"mount-docs-endpoint" env:"SIMBA_DOCS_MOUNT_DOCS_UI_ENDPOINT" default:"true"` // OpenAPIFilePath is the path to the OpenAPI YAML file OpenAPIFilePath string `yaml:"open-api-file-path" env:"SIMBA_DOCS_OPENAPI_FILE_PATH" default:"/openapi.json"` // DocsUIPath is the path to the API documentation DocsUIPath string `yaml:"docs-path" env:"SIMBA_DOCS_UI_PATH" default:"/docs"` // ServiceName is the name of the service ServiceName string }
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 WithApplicationName ¶ added in v0.16.0
WithApplicationName sets the application name
func WithApplicationVersion ¶ added in v0.16.0
WithApplicationVersion sets the application version
func WithDocsUIPath ¶ added in v0.16.0
WithDocsUIPath sets the docs UI path
func WithEnvGetter ¶ added in v0.16.0
WithEnvGetter is a test-only option to mock environment variable retrieval
func WithGenerateOpenAPIDocs ¶ added in v0.16.0
WithGenerateOpenAPIDocs sets whether to generate OpenAPI docs
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 WithMountDocsUIEndpoint ¶ added in v0.16.0
WithMountDocsUIEndpoint sets whether to mount the docs endpoint
func WithOpenAPIFilePath ¶ added in v0.16.0
WithOpenAPIFilePath sets the OpenAPI JSON file path
func WithRequestIdMode ¶ added in v0.16.0
func WithRequestIdMode(mode simbaModels.RequestIdMode) Option
WithRequestIdMode sets the request ID mode
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 { // Application settings Application `yaml:"application"` // Server settings Server `yaml:"server"` // Request settings Request `yaml:"request"` // Docs settings Docs `yaml:"docs"` // Logger settings Logger *slog.Logger `yaml:"-" env:"-"` // contains filtered or unexported fields }
Simba is a struct that holds the application settings
func LoadWithOptions ¶ added in v0.14.0
LoadWithOptions loads settings using the options pattern