config

package
v2.0.0-...-fe6a7a6 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ProjectName  string
	Environment  string
	DebugLogPath string
	Secret       string
	AccessLog    struct {
		On                bool
		BodyDump          bool
		Path              string
		BodyDumpMaskParam []string
		ReqHeaderParam    []string
		SkipEndpoints     []string
	}
	Prometheus struct {
		On            bool
		SkipEndpoints []string
		Subsystem     string
	}
	HTTP struct {
		Port            string
		Host            string
		BodyLimit       string
		IsHttpsRedirect bool
		Timeout         time.Duration
		ErrorMessage    struct {
			E404 struct {
				Json []struct {
					Key   string
					Value string
				}
				Html struct {
					File string
				}
			}
			E405 struct {
				Json []struct {
					Key   string
					Value string
				}
				Html struct {
					File string
				}
			}
			E500 struct {
				Json []struct {
					Key   string
					Value string
				}
				Html struct {
					File string
				}
			}
			E504 struct {
				Json []struct {
					Key   string
					Value string
				}
				Html struct {
					File string
				}
			}
			Default struct {
				Json []struct {
					Key   string
					Value string
				}
				Html struct {
					File string
				}
			}
		}
		KeepAlive     bool
		AllowedMethod []string
		SSL           struct {
			On            bool
			CertFile      string
			PrivFile      string
			MinTLSVersion uint16
		}
		ShutdownTimeout time.Duration
	}
	NetHttpFastTransporter struct {
		On                  bool
		MaxIdleConns        *int
		MaxIdleConnsPerHost *int
		MaxConnsPerHost     *int
		IdleConnTimeout     *time.Duration
		DNSCacheTimeout     *time.Duration
	}
	HTML struct {
		ViewsTemplateCache bool
	}
	Database struct {
		Tenant struct {
			On bool
		}
		MySQL  dbdrivers.SQLConfig
		Mongo  dbdrivers.MongoConfig
		Redis  dbdrivers.RedisConfig
		Memory dbdrivers.MemoryConfig
	}
	Sentry   Sentry
	Security struct {
		HTTP struct {
			Header struct {
				XssProtection         string
				ContentTypeNosniff    string
				XFrameOptions         string
				HstsMaxAge            int
				ContentSecurityPolicy string
			}
		}
	}
	AsyncPool []struct {
		Name       string
		Size       *int
		BlockAfter *int
	}
	AsyncPoolReleaseTimeout time.Duration
}
var Bean *Config

Hold the useful configuration settings of bean so that we can use it quickly from anywhere.

func LoadConfig

func LoadConfig(filename string) (*Config, error)

LoadConfig parses a given config file into global Bean variable.

type Sentry

type Sentry struct {
	On                  bool
	Debug               bool
	Dsn                 string
	Timeout             time.Duration
	TracesSampleRate    float64
	SkipTracesEndpoints []string
	ClientOptions       *sentry.ClientOptions
	ConfigureScope      func(scope *sentry.Scope)
}

Jump to

Keyboard shortcuts

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