package serverconfig
import "golang.org/x/pkgsite/internal/config/serverconfig"
Package serverconfig resolves shared configuration for Go Discovery services.
Index ¶
- func GetEnv(key, fallback string) string
- func GetEnvInt(ctx context.Context, key string, fallback int) int
- func Init(ctx context.Context) (_ *config.Config, err error)
- func OnAppEngine() bool
- func OnGCP() bool
- func OnGKE() bool
- func ValidateAppVersion(appVersion string) error
Functions ¶
func GetEnv ¶
GetEnv looks up the given key from the environment, returning its value if it exists, and otherwise returning the given fallback value.
func GetEnvInt ¶
GetEnvInt looks up the given key from the environment and expects an integer, returning the integer value if it exists, and otherwise returning the given fallback value. If the environment variable has a value but it can't be parsed as an integer, GetEnvInt terminates the program.
func Init ¶
Init resolves all configuration values provided by the config package. It must be called before any configuration values are used.
func OnAppEngine ¶
func OnAppEngine() bool
OnAppEngine reports if the current process is running in an AppEngine environment.
func OnGCP ¶
func OnGCP() bool
OnGCP reports whether the current process is running on Google Cloud Platform.
func OnGKE ¶
func OnGKE() bool
OnGKE reports whether the current process is running on GKE.
func ValidateAppVersion ¶
ValidateAppVersion validates that appVersion follows the expected format defined by AppVersionFormat.
Source Files ¶
config.go
- Version
- v0.0.0-20250218150137-224a1368cf02 (latest)
- Published
- Feb 18, 2025
- Platform
- linux/amd64
- Imports
- 19 packages
- Last checked
- 2 months ago –
Tools for package owners.