Documentation ¶
Overview ¶
Package environments determines code behavior across services such as debug mode.
usage: config := environments.GetConfig(os.Getenv(environments.EnvVar))
Package environments determines code behavior across services such as debug mode.
usage: config := environments.GetConfig(os.Getenv(environments.EnvVar))
Index ¶
Constants ¶
const ( // DefaultEnv is the fallback environment DefaultEnv = "development" // EnvVar is the typical environment variable used to determine // the current environment, e.g. with os.Getenv(EnvVar) EnvVar = "ENV" // SentryEnvVar is the environment variable name for fetching this secret from k8s SentryEnvVar = "SENTRY_DSN" // DeployEnvVar is set by Kubernetes during a new deployment so we can identify the code version DeployEnvVar = "DEPLOY" // GoogleCloudSecretPath is the file location for the mounted GCloud auth token GoogleCloudSecretPath = "/etc/secrets/gcloud.json" )
const ( // GcloudEnvVar is the environment variable for accessing the GCloud secret key GcloudEnvVar = "GCLOUD" // GcloudProjectEnvVar is the environment variable for accessign the Gcloud project name GcloudProjectEnvVar = "GCLOUD_PROJECT" )
Variables ¶
This section is empty.
Functions ¶
func GetGoogleCloudProject ¶
func GetGoogleCloudProject() string
GetGoogleCloudProject returns the identifier of the google cloud project8
func GetPublicSentryDSN ¶
GetPublicSentryDSN returns a Sentry Id that can be returned in JS
Types ¶
type Config ¶
type Config struct { Name string // Name of the environment, which shows up in logs Debug bool // Controls security and log verbosity ExternalApex string // Apex domain off of which services operate externally InternalApex string // Apex domain off of which services operate internally LogLevel logrus.Level // Verbosity of logging Scheme string // default URL scheme - http or https }
Config controls behavior for the environment across services
func GetConfig ¶
GetConfig returns the environment config Typically you should use os.Getenv("ENV") and pass that in here,
func (*Config) GetDeployVersion ¶
GetDeployVersion returns the current code version from Jenkins in non-dev environments
func (*Config) GetIntercomClient ¶
GetIntercomClient reutrns an intercom.io client
func (*Config) GetSentryDSN ¶
GetSentryDSN returns the secret API key for Sentry.io
type SentryClient ¶
type SentryClient interface { CapturePanicAndWait(func(), map[string]string, ...sentry.Interface) (interface{}, string) CaptureError(error, map[string]string, ...sentry.Interface) string SetHttpContext(*sentry.Http) SetUserContext(*sentry.User) ClearContext() }
SentryClient is a type for handling errors (without importing sentry directly)
func ErrorClient ¶
func ErrorClient(c SentryConfig) SentryClient
ErrorClient returns a an error handler for sending to GetSentry.com