config

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultListenAddress = "0.0.0.0:8080"

Variables

View Source
var ErrInvalidListenAddress = errors.New("invalid listen address")

Functions

func ValidateConfig

func ValidateConfig(config *Config) error

ValidateConfig validates the server configuration

Types

type CORS

type CORS struct {
	// A list of origins a cross-domain request can be executed from.
	// If the special '*' value is present in the list, all origins will be allowed.
	// An origin may contain a wildcard (*) to replace 0 or more characters (i.e.: http://*.domain.com).
	// Only one wildcard can be used per origin
	AllowedOrigins []string `toml:"cors_allowed_origins"`

	// A list of non-simple headers the client is allowed to use with cross-domain requests
	AllowedHeaders []string `toml:"cors_allowed_headers"`

	// A list of methods the client is allowed to use with cross-domain requests
	AllowedMethods []string `toml:"cors_allowed_methods"`
}

CORS defines the server CORS configuration

func DefaultCORSConfig

func DefaultCORSConfig() *CORS

DefaultCORSConfig returns the default CORS configuration

type Config

type Config struct {
	// The associated CORS config, if any
	CORSConfig *CORS `toml:"cors_config"`

	// The address at which the server will be served.
	// Format should be: <IP>:<PORT>
	ListenAddress string `toml:"listen_address"`
}

Config defines the base-level server configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default server configuration

func Read

func Read(path string) (*Config, error)

Read reads the configuration from the given path

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL