config

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig[T any](path string, target *T) error

Loads config into the target struct from the given path - an INI file. Can override config values with environment variables. Don't put secrets in the INI file. It first loads the INI file and then overrides the values with environment variables.

Types

type BootConfig

type BootConfig struct {
	// ssl
	SslBucket string `env:"SSL-BUCKET" ini:"ssl_bucket"`
	Domain    string `env:"DOMAIN" ini:"domain"`

	// Cloud
	AzureStorageAccount string `env:"AZURE-STORAGE-ACCOUNT" ini:"azure_storage_account"`

	GcpProjectId string `env:"GCP-PROJECT-ID" ini:"gcp_project_id"`
}

Note: go-api-boot holds clear distinction between config and secrets. Config is for application configuration that can be stored in version control. Secrets are sensitive information like API keys, passwords, etc. that should not be stored in version control. Secrets should be exclusively read from environment variables.

Jump to

Keyboard shortcuts

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