{"modulePath":"github.com/theopenlane/core","version":"v1.34.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package config\n\nPackage config holds the echo server configuration utilities\n\n## Variables\n\n```go\nvar (\n\t// DefaultConfigRefresh sets the default interval to refresh the config.\n\tDefaultConfigRefresh = 10 * time.Minute\n\t// DefaultTLSConfig is the default TLS config used when HTTPS is enabled\n\tDefaultTLSConfig = \u0026tls.Config{\n\t\tMinVersion:               tls.VersionTLS12,\n\t\tCurvePreferences:         []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256},\n\t\tPreferServerCipherSuites: true,\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\t},\n\t}\n)\n```\n\n## Types\n\n```go\ntype Config struct {\n\t// add all the configuration settings for the server\n\tSettings config.Config\n\t// Routes contains the handler functions\n\tRoutes []http.Handler\n\t// DefaultMiddleware to enable on the echo server used on all requests\n\tDefaultMiddleware []echo.MiddlewareFunc\n\t// GraphMiddleware to enable on the echo server used on graph requests\n\tGraphMiddleware []echo.MiddlewareFunc\n\t// Handler contains the required settings for REST handlers including ready checks and JWT keys\n\tHandler handlers.Handler\n\t// SessionConfig manages sessions for users\n\tSessionConfig *sessions.SessionConfig\n\t// StorageService manages objects for the server\n\tStorageService *objects.Service\n}\n```\nConfig is the configuration for the http server\n\n```go\nfunc (c *Config) Get() (*Config, error)\n```\nGet implements ConfigProvider.\n\n```go\nfunc (c *Config) WithAutoCert(host string) *Config\n```\nWithAutoCert generates a letsencrypt certificate, a valid host must be provided\n\n```go\nfunc (c Config) WithDefaultTLSConfig() Config\n```\nWithDefaultTLSConfig sets the default TLS Configuration\n\n```go\nfunc (c *Config) WithTLSCerts(certFile, certKey string) *Config\n```\nWithTLSCerts sets the TLS Cert and Key locations\n\n```go\nfunc (c Config) WithTLSDefaults() Config\n```\nWithTLSDefaults sets tls default settings assuming a default cert and key file location.\n\n```go\ntype Provider interface {\n\t// Get returns the server configuration\n\tGet() (*Config, error)\n}\n```\nProvider serves as a common interface to read echo server configuration\n\n```go\ntype ProviderWithRefresh struct {\n\tsync.RWMutex\n\t// contains filtered or unexported fields\n}\n```\nProviderWithRefresh 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\n\n```go\nfunc NewProviderWithRefresh(cfgProvider Provider) (*ProviderWithRefresh, error)\n```\nNewProviderWithRefresh function is a constructor function that creates a new instance of ProviderWithRefresh\n\n```go\nfunc (s *ProviderWithRefresh) Close()\n```\nClose 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\n\n```go\nfunc (s *ProviderWithRefresh) Get() (*Config, error)\n```\nGetConfig retrieves the current echo server configuration; it acquires a read lock to ensure thread safety and returns the \\`config\\` field\n\n","path":"github.com/theopenlane/core/internal/httpserve/config","name":"config","synopsis":"Package config holds the echo server configuration utilities","isRedistributable":true}
