Documentation
¶
Overview ¶
Package gs_conf provides a layered configuration system for Go-Spring applications. It merges multiple configuration sources into a single layered property set, supporting profile-specific files and optional imports of additional configuration files.
This implementation follows the Spring Boot layered configuration model, where configuration sources have a well-defined precedence order, and higher-priority sources override lower-priority ones when the same key appears in multiple places.
Precedence Order (Highest → Lowest) ¶
Configuration sources are organized into layers according to priority:
- **Command-line arguments** - Highest precedence
- **Operating system environment variables**
- **Profile-specific configuration** (`app-{profile}.yaml` etc.) - Imports declared in profile configuration files (`spring.app.imports`) - The profile-specific configuration file itself
- **Application base configuration** (`app.yaml` etc.) - Imports declared in application configuration files (`spring.app.imports`) - The base application configuration file itself
- **Built-in default properties** - Lowest precedence
Index ¶
Constants ¶
const CommandArgsPrefix = "GS_ARGS_PREFIX"
CommandArgsPrefix defines the environment variable name used to override the default option prefix. This allows users to customize the prefix used for command-line options if needed.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct {
Properties *flatten.Properties
}
AppConfig represents the layered configuration of an application.