Documentation ¶
Index ¶
- func GetenvDefault(key, defaultValue string) string
- func GoodTLSConfig(src *tls.Config) *tls.Configdeprecated
- func IsCI() bool
- func IsDevelopment() bool
- func IsProduction() bool
- func Must[T any](value T, err error) T
- func RandInt64() (int64, error)
- func TLSConfig(getCertificate GetCertificate) *tls.Config
- type GetCertificate
- func GetCertificateFromFiles(certFile, keyFile string) GetCertificate
- func GetCertificateFromLetsEncrypt(m *autocert.Manager) GetCertificate
- func GetCertificateFunc(m *autocert.Manager, devCertFile, devKeyFile string) GetCertificatedeprecated
- func GetCertificateFuncFromFiles(certFile, keyFile string) GetCertificatedeprecated
- func GetCertificateFuncFromLetsEncrypt(m *autocert.Manager) GetCertificatedeprecated
- func GetDevelopmentCert(certFile, keyFile string) GetCertificatedeprecated
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetenvDefault ¶ added in v0.0.3
GetenvDefault returns the value of environment variable called by key. If the value is undefined or in other words empty, then value of given defaultValue is returned.
func GoodTLSConfig
deprecated
added in
v0.0.8
GoodTLSConfig configures a copy of given tls.Config with good settings.
Deprecated: GooldTLSConfig is unused.
func IsCI ¶ added in v0.0.5
func IsCI() bool
IsCI returns true if environment variable CI has value true and false otherwise.
func IsDevelopment ¶ added in v0.0.4
func IsDevelopment() bool
IsDevelopment checks environment variable ENV and returns true only if ENV value is `development`.
func IsProduction ¶ added in v0.0.4
func IsProduction() bool
IsProduction checks the value of environment variable ENV and returns true if value is `production`.
func Must ¶
Must checks for given err. If err is not nil panic is called, otherwise returns value T.
func TLSConfig ¶
func TLSConfig(getCertificate GetCertificate) *tls.Config
TLSConfig returns secure TLS configuration for Internet server.
Types ¶
type GetCertificate ¶ added in v0.11.0
type GetCertificate func(*tls.ClientHelloInfo) (*tls.Certificate, error)
GetCertificate returns a Certificate based on the given ClientHelloInfo.
func GetCertificateFromFiles ¶ added in v0.11.0
func GetCertificateFromFiles(certFile, keyFile string) GetCertificate
GetCertificateFromFiles loads GetCertificate func from given TLS cert files.
func GetCertificateFromLetsEncrypt ¶ added in v0.11.0
func GetCertificateFromLetsEncrypt(m *autocert.Manager) GetCertificate
GetCertificateFromLetsEncrypt loads GetCertificate func from given Let's Encrypt Manager.
func GetCertificateFunc
deprecated
added in
v0.0.6
func GetCertificateFunc(m *autocert.Manager, devCertFile, devKeyFile string) GetCertificate
GetCertificateFunc loads certificates for development or production depending on return value of function [kkn.fi/infra#IsProduction].
Deprecated: GetCertificateFunc is deprecated.
func GetCertificateFuncFromFiles
deprecated
added in
v0.0.6
func GetCertificateFuncFromFiles(certFile, keyFile string) GetCertificate
GetCertificateFuncFromFiles loads GetCertificate func from given TLS cert files.
Deprecated: GetCertificateFuncFromFiles is deprecated. Use GetCertificateFromFiles instead.
func GetCertificateFuncFromLetsEncrypt
deprecated
added in
v0.0.6
func GetCertificateFuncFromLetsEncrypt(m *autocert.Manager) GetCertificate
GetCertificateFuncFromLetsEncrypt loads GetCertificate func from given Let's Encrypt Manager.
Deprecated: GetCertificateFuncFromFiles is deprecated. Use GetCertificateFromLetsEncrypt instead.
func GetDevelopmentCert
deprecated
added in
v0.0.8
func GetDevelopmentCert(certFile, keyFile string) GetCertificate
Deprecated: GetDevelopmentCert is deprecated. Use GetCertificateFuncFromFiles instead.
type Logger ¶
Logger implements a common logger interaface compatible with standard log.Logger.