Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
func Load(conf CurioStack, confFiles fs.FS) error
Load resolves the configuration into the provided conf object. The conf object must embed Common.
Config is merged in order from the following sources:
- config.yaml embedded in this package. These are the curiostack defaults where applicable.
- config.yaml at the base of the repository, identified by being next to go.work, if present.
- config.yaml in the provided fs.FS if present.
- config-local.yaml in the provided fs.FS if present and CONFIG_ENV is unset (local development).
- config-nonlocal.yaml in the provided fs.FS if present and CONFIG_ENV is set.
- config-${CONFIG_ENV}.yaml in the provided fs.FS if present and CONFIG_ENV is set.
- Environment variables, where the config key is capitalized with '.' replaced with '_'.
Types ¶
type Common ¶
type Common struct { // Server holds the configuration for the server. Server Server `koanf:"server"` // Google holds the configruation for using common GCP functionality. Google Google `koanf:"google"` // Logging holds the configuration for logging. Logging Logging `koanf:"logging"` }
Common holds curiostack standard configuration objects. Server configuration objects should embed this and define their own fields on top of it.
type CurioStack ¶
type CurioStack interface { // GetCommon returns the Common embedded in this configuration. It is equivalent to // calling e.g. `&conf.Common`. GetCommon() *Common // contains filtered or unexported methods }
CurioStack is a configuration object for a project using CurioStack. To create a CurioStack configuration object, embed Common into a config struct for your project, adding any other configuration fields you need. This interface cannot be implemented outside of this package.
type Google ¶
type Google struct { // Project is the GCP project ID. Project string `koanf:"project"` // Region is the default region development resources are deployed to. Region string `koanf:"region"` }
Google holds the configuration for using common GCP functionality.
Click to show internal directories.
Click to hide internal directories.