config

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config provides configuration management for the Zero HTTP server. It supports loading configuration from environment variables with sensible defaults. Options (WithConfig/WithPort/etc) override everything.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host                string
	Port                int
	ReadTimeout         time.Duration
	WriteTimeout        time.Duration
	IdleTimeout         time.Duration
	MaxJSONBodySize     int64
	MaxUploadedFileSize int64
}

Config holds the server configuration

func Load

func Load() *Config

Load loads configuration from environment variables with sensible defaults. Unparseable env values are logged at WARN level and the default is used.

func (*Config) GetAddr

func (c *Config) GetAddr() string

GetAddr returns the server address as a string

func (*Config) SetHost

func (c *Config) SetHost(host string)

SetHost sets the host

func (*Config) SetIdleTimeout

func (c *Config) SetIdleTimeout(timeout time.Duration)

SetIdleTimeout sets the idle timeout

func (*Config) SetMaxJSONBodySize

func (c *Config) SetMaxJSONBodySize(size int64)

SetMaxJSONBodySize sets the maximum JSON body size in bytes

func (*Config) SetMaxUploadedFileSize

func (c *Config) SetMaxUploadedFileSize(size int64)

SetMaxUploadedFileSize sets the maximum uploaded file size in bytes

func (*Config) SetPort

func (c *Config) SetPort(port int)

SetPort sets the port

func (*Config) SetReadTimeout

func (c *Config) SetReadTimeout(timeout time.Duration)

SetReadTimeout sets the read timeout

func (*Config) SetWriteTimeout

func (c *Config) SetWriteTimeout(timeout time.Duration)

SetWriteTimeout sets the write timeout

Jump to

Keyboard shortcuts

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