Documentation
¶
Overview ¶
Package utilities provides shared configuration-loading helpers for the config module.
Its main responsibility is to load application settings from resources/application.yml, resources/application.yaml, or resources/application.json, merge .env and .env.local files, and apply environment-variable overrides derived from the Viper key paths.
LoadEnv also accepts a directory that contains application.* directly for compatibility with modules that keep local example configuration beside their code.
Main entry point:
- LoadEnv to load configuration files and apply override rules
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadEnv ¶
LoadEnv resolves the GoForge runtime configuration directory and loads it into Viper. If prefixPath is empty, the current working directory is used. If prefixPath contains application.yml, application.yaml, or application.json directly, that directory is used; otherwise LoadEnv walks upward looking for the nearest resources/ directory with one of those files. When no matching resources/ directory is found, it falls back to prefixPath/resources so the returned read error points at the expected location.
Configuration is loaded in this order: application.yml, application.yaml, application.json, .env, .env.local from the resolved directory, and finally process environment variable overrides derived from the existing Viper key paths, for example app.name -> APP_NAME. Missing .env files are ignored, but failure to read the selected application file is returned.
func SetModeTest ¶ added in v0.0.79
func SetModeTest()
SetModeTest configures shared packages for test execution.
It enables logger test mode, switches Gin to test mode, and sets Viper defaults that disable behaviors not needed during tests.
Types ¶
This section is empty.