Documentation ¶
Overview ¶
Package config holds the echo server configuration utilities
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 // ObjectManager manages objects for the server ObjectManager *objects.Objects }
Config is the configuration for the http server
func (*Config) WithAutoCert ¶
WithAutoCert generates a letsencrypt certificate, a valid host must be provided
func (Config) WithDefaultTLSConfig ¶
WithDefaultTLSConfig sets the default TLS Configuration
func (*Config) WithTLSCerts ¶
WithTLSCerts sets the TLS Cert and Key locations
func (Config) WithTLSDefaults ¶
WithTLSDefaults sets tls default settings assuming a default cert and key file location.
type ConfigProvider ¶
type ConfigProvider interface { // GetConfig returns the server configuration GetConfig() (*Config, error) }
ConfigProvider serves as a common interface to read echo server configuration
type ConfigProviderWithRefresh ¶
ConfigProviderWithRefresh 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 NewConfigProviderWithRefresh ¶
func NewConfigProviderWithRefresh(cfgProvider ConfigProvider) (*ConfigProviderWithRefresh, error)
NewConfigProviderWithRefresh function is a constructor function that creates a new instance of ConfigProviderWithRefresh
func (*ConfigProviderWithRefresh) Close ¶
func (s *ConfigProviderWithRefresh) 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 (*ConfigProviderWithRefresh) GetConfig ¶
func (s *ConfigProviderWithRefresh) GetConfig() (*Config, error)
GetConfig retrieves the current echo server configuration; it acquires a read lock to ensure thread safety and returns the `config` field