config

package
v0.48.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config holds the echo server configuration utilities

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultConfigRefresh sets the default interval to refresh the config.
	DefaultConfigRefresh = 10 * time.Minute
	// DefaultTLSConfig is the default TLS config used when HTTPS is enabled
	DefaultTLSConfig = &tls.Config{
		MinVersion:               tls.VersionTLS12,
		CurvePreferences:         []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256},
		PreferServerCipherSuites: true,
		CipherSuites: []uint16{
			tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
			tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
		},
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// add all the configuration settings for the server
	Settings config.Config
	// Routes contains the handler functions
	Routes []http.Handler
	// DefaultMiddleware to enable on the echo server used on all requests
	DefaultMiddleware []echo.MiddlewareFunc
	// GraphMiddleware to enable on the echo server used on graph requests
	GraphMiddleware []echo.MiddlewareFunc
	// Handler contains the required settings for REST handlers including ready checks and JWT keys
	Handler handlers.Handler
	// SessionConfig manages sessions for users
	SessionConfig *sessions.SessionConfig
	// StorageService manages objects for the server
	StorageService *objects.Service
}

Config is the configuration for the http server

func (*Config) Get added in v0.8.5

func (c *Config) Get() (*Config, error)

Get implements ConfigProvider.

func (*Config) WithAutoCert

func (c *Config) WithAutoCert(host string) *Config

WithAutoCert generates a letsencrypt certificate, a valid host must be provided

func (Config) WithDefaultTLSConfig

func (c Config) WithDefaultTLSConfig() Config

WithDefaultTLSConfig sets the default TLS Configuration

func (*Config) WithTLSCerts

func (c *Config) WithTLSCerts(certFile, certKey string) *Config

WithTLSCerts sets the TLS Cert and Key locations

func (Config) WithTLSDefaults

func (c Config) WithTLSDefaults() Config

WithTLSDefaults sets tls default settings assuming a default cert and key file location.

type Provider added in v0.8.5

type Provider interface {
	// Get returns the server configuration
	Get() (*Config, error)
}

Provider serves as a common interface to read echo server configuration

type ProviderWithRefresh added in v0.8.5

type ProviderWithRefresh struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ProviderWithRefresh shows a config provider with automatic refresh; it contains fields and methods to manage the configuration, and refresh it periodically based on a specified interval

func NewProviderWithRefresh added in v0.8.5

func NewProviderWithRefresh(cfgProvider Provider) (*ProviderWithRefresh, error)

NewProviderWithRefresh function is a constructor function that creates a new instance of ProviderWithRefresh

func (*ProviderWithRefresh) Close added in v0.8.5

func (s *ProviderWithRefresh) Close()

Close function is used to stop the automatic refresh of the configuration. It stops the ticker that triggers the refresh and closes the stop channel, which signals the goroutine to stop refreshing the configuration

func (*ProviderWithRefresh) Get added in v0.8.5

func (s *ProviderWithRefresh) Get() (*Config, error)

GetConfig retrieves the current echo server configuration; it acquires a read lock to ensure thread safety and returns the `config` field

Jump to

Keyboard shortcuts

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