Documentation
¶
Overview ¶
Package serverconfig resolves shared configuration for Go Discovery services.
Index ¶
- func GetEnv(key, fallback string) string
- func GetEnvDuration(ctx context.Context, key string, fallback time.Duration) time.Duration
- func GetEnvInt(ctx context.Context, key string, fallback int) int
- func Init(ctx context.Context) (_ *config.Config, err error)
- func OnAppEngine() bool
- func OnCloudRun() bool
- func OnGCP() bool
- func OnGKE() bool
- func ValidateAppVersion(appVersion string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 GetEnvDuration ¶
GetEnvDuration looks up the given key from the environment and expects a duration string, returning the duration 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 a duration, GetEnvDuration terminates the program.
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 OnCloudRun ¶
func OnCloudRun() bool
OnCloudRun reports whether the current process is running on Cloud Run.
func OnGCP ¶
func OnGCP() bool
OnGCP reports whether the current process is running on Google Cloud Platform.
func ValidateAppVersion ¶
ValidateAppVersion validates that appVersion follows the expected format defined by AppVersionFormat.
Types ¶
This section is empty.