Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCoreModule ¶
NewCoreModule provides core functionality: config, logger, and health. It also sets increased startup and shutdown timeouts for fx application lifecycle.
Options:
- WithAppConfig: provide static AppConfig (useful for tests)
- WithLoggerConfig: provide static logger Config (useful for tests)
Example usage:
// Production - loads config from environment/viper
core.NewCoreModule()
// Testing - with static configs
core.NewCoreModule(
core.WithAppConfig(config.AppConfig{...}),
core.WithLoggerConfig(logger.Config{...}),
core.WithoutEnvFile(),
core.WithoutConfigFile(),
)
Types ¶
type Option ¶
type Option func(*coreOptions)
Option is a functional option for configuring the core module.
func WithAppConfig ¶
WithAppConfig provides a static AppConfig (useful for tests). When set, the AppConfig will not be loaded from environment variables.
func WithLoggerConfig ¶
WithLoggerConfig provides a static logger Config (useful for tests). When set, the logger configuration will not be loaded from viper.
func WithoutConfigFile ¶
func WithoutConfigFile() Option
WithoutConfigFile disables loading of config file (config.yaml). Useful for tests where configuration is provided via options.
func WithoutEnvFile ¶
func WithoutEnvFile() Option
WithoutEnvFile disables loading of .env file. Useful for tests or environments where .env files are not used.