Documentation
¶
Index ¶
- func EncryptParams[T any](keyByte, ivByte []byte, paramFile string, params *ApplicationParams[T]) error
- func GetValueFromMap[T any](name string, mp map[string]T) *T
- func LogRotate(logger *lumberjack.Logger)
- func Write[T any](params *ApplicationParams[T], path string) error
- type ApplicationParams
- func (m ApplicationParams[SpecialParams]) GetConstants(name string) *Constants
- func (m ApplicationParams[SpecialParams]) GetDB(name string) *DbParams
- func (m ApplicationParams[SpecialParams]) GetLogging() LogParams
- func (m ApplicationParams[SpecialParams]) GetNetwork(name string) *NetworkParams
- func (m ApplicationParams[SpecialParams]) GetParam(group, name string) *string
- func (m ApplicationParams[SpecialParams]) GetRemoteApi(name string) *libCallApi.RemoteApi
- func (m ApplicationParams[SpecialParams]) GetSecureParam(group, name string) *SecurityParam
- func (m ApplicationParams[SpecialParams]) GetSecurityModule(name string) *SecurityModule
- func (m ApplicationParams[SpecialParams]) GetSpecificParams(name string) any
- func (m ApplicationParams[SpecialParams]) SetDB(name string, db *DbParams)
- type Constants
- type DbParams
- type LogParams
- type NetworkParams
- type ParamInterface
- type ParametersMap
- type SecureParametersMap
- type SecurityModule
- type SecurityParam
- type SplunkParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncryptParams ¶ added in v0.16.1
func EncryptParams[T any](keyByte, ivByte []byte, paramFile string, params *ApplicationParams[T]) error
func GetValueFromMap ¶ added in v0.16.0
func LogRotate ¶ added in v0.9.29
func LogRotate(logger *lumberjack.Logger)
Types ¶
type ApplicationParams ¶ added in v0.16.0
type ApplicationParams[SpecialParams any] struct { Network map[string]NetworkParams `yaml:"networks"` // Definition of all networks, all networks will be started at startup Logging LogParams `yaml:"logging"` DB map[string]DbParams `yaml:"db"` // Database connection strings SecurityModule map[string]SecurityModule `yaml:"securityModule"` // Security modules if exists RemoteApis map[string]libCallApi.RemoteApi `yaml:"remoteApis"` // List of remote-api definition Constants map[string]Constants `yaml:"constants"` // Constants used in app [response constants should be placed here] ParameterGroups map[string]ParametersMap `yaml:"parameterGroups"` // Simple string parameters groupped by names SecureParameterGroups map[string]SecureParametersMap `yaml:"secureParameterGroups"` // Encrypted string parameters, will be parsed at startup Specific *SpecialParams `yaml:"specific"` // Application specific args, should be parsed as yaml Metrics *ginprom.Prometheus `json:"-"` // Applications metrics storage }
Application can be designed with below params as default
func DecryptParams ¶ added in v0.16.1
func DecryptParams[T any](keyByte, ivByte []byte, params *ApplicationParams[T]) (*ApplicationParams[T], error)
func ParsePrams ¶ added in v0.16.2
func ParsePrams[T any](paramFile string, keys [][]byte) (*ApplicationParams[T], error)
func (ApplicationParams[SpecialParams]) GetConstants ¶ added in v0.16.0
func (m ApplicationParams[SpecialParams]) GetConstants(name string) *Constants
func (ApplicationParams[SpecialParams]) GetDB ¶ added in v0.16.0
func (m ApplicationParams[SpecialParams]) GetDB(name string) *DbParams
func (ApplicationParams[SpecialParams]) GetLogging ¶ added in v0.16.0
func (m ApplicationParams[SpecialParams]) GetLogging() LogParams
func (ApplicationParams[SpecialParams]) GetNetwork ¶ added in v0.16.0
func (m ApplicationParams[SpecialParams]) GetNetwork(name string) *NetworkParams
func (ApplicationParams[SpecialParams]) GetParam ¶ added in v0.16.1
func (m ApplicationParams[SpecialParams]) GetParam(group, name string) *string
func (ApplicationParams[SpecialParams]) GetRemoteApi ¶ added in v0.16.0
func (m ApplicationParams[SpecialParams]) GetRemoteApi(name string) *libCallApi.RemoteApi
func (ApplicationParams[SpecialParams]) GetSecureParam ¶ added in v0.16.1
func (m ApplicationParams[SpecialParams]) GetSecureParam(group, name string) *SecurityParam
func (ApplicationParams[SpecialParams]) GetSecurityModule ¶ added in v0.16.0
func (m ApplicationParams[SpecialParams]) GetSecurityModule(name string) *SecurityModule
func (ApplicationParams[SpecialParams]) GetSpecificParams ¶ added in v0.16.0
func (m ApplicationParams[SpecialParams]) GetSpecificParams(name string) any
func (ApplicationParams[SpecialParams]) SetDB ¶ added in v0.16.2
func (m ApplicationParams[SpecialParams]) SetDB(name string, db *DbParams)
type DbParams ¶ added in v0.16.0
type DbParams struct {
DataBaseType string `yaml:"dbType"`
DataBaseAddress SecurityParam `yaml:"dbAddress"`
Db *sql.DB `yaml:"-"`
}
type LogParams ¶ added in v0.16.0
type LogParams struct {
LogPath string `yaml:"logPath"`
LogSize int `yaml:"logSize"`
LogCompress bool `yaml:"logCompress"`
SkipPaths []string `yaml:"skipPaths"`
LogHeader string `yaml:"logHeader"`
UseSlog bool `yaml:"useSlog"`
Splunk *SplunkParams `yaml:"splunkParams"`
}
Logging related params
func (LogParams) GetHeaderName ¶ added in v0.16.2
func (LogParams) GetLogCompress ¶ added in v0.16.2
func (LogParams) GetLogPath ¶ added in v0.16.2
func (LogParams) GetLogSize ¶ added in v0.16.2
func (LogParams) GetSkipPaths ¶ added in v0.16.2
type NetworkParams ¶ added in v0.16.0
type NetworkParams struct {
Port string `yaml:"port"`
StaticPort string `yaml:"staticPort"`
StaticPath string `yaml:"staticPath"`
///////////////////// TLS ////////////////////////////////////////////
TlsPort string `yaml:"tlsPort"`
TlsKey string `yaml:"tlsKey"`
TlsCert string `yaml:"tlsCert"`
}
Network related Params
type ParamInterface ¶ added in v0.9.1
type ParamInterface interface {
GetNetwork(name string) *NetworkParams
GetLogging() LogParams
GetDB(name string) *DbParams
SetDB(name string, db *DbParams)
GetSecurityModule(name string) *SecurityModule
GetRemoteApi(name string) *libCallApi.RemoteApi
GetParam(group, name string) *string
GetSecureParam(group, name string) *SecurityParam
GetConstants(name string) *Constants
GetSpecificParams(name string) any
}
type ParametersMap ¶ added in v0.16.0
type SecureParametersMap ¶ added in v0.16.0
type SecureParametersMap struct {
SecureParams map[string]SecurityParam `yaml:"secureParams"`
}
type SecurityModule ¶ added in v0.16.0
type SecurityParam ¶ added in v0.16.0
func Decrypt ¶ added in v0.16.1
func Decrypt(key, iv, name string, field SecurityParam) (*SecurityParam, error)
func FillCipher ¶ added in v0.16.1
func FillCipher(key, iv string, field SecurityParam) (*SecurityParam, error)
type SplunkParams ¶ added in v0.16.0
type SplunkParams struct {
URL string `yaml:"url"` // Splunk HEC endpoint (e.g., "https://<splunk-server>:8088/services/collector/event")
Token string `yaml:"token"` // HEC token
SourceType string `yaml:"source"` // Splunk source type
Source string `yaml:"sourceType"` // Splunk source
Index string `yaml:"index"` // Splunk index
RawHandler bool `yaml:"rawHandler"`
}
SplunkParams holds configuration for the Splunk logger.
Click to show internal directories.
Click to hide internal directories.