core

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCoreModule

func NewCoreModule(opts ...Option) fx.Option

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

func WithAppConfig(cfg config.AppConfig) Option

WithAppConfig provides a static AppConfig (useful for tests). When set, the AppConfig will not be loaded from environment variables.

func WithLoggerConfig

func WithLoggerConfig(cfg logger.Config) Option

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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