Involved Source Files
Package config resolves shared configuration for Go Discovery services, and
provides functions to access this configuration.
The Init function should be called before using any of the configuration accessors.
Package-Level Type Names (total 3, in which 2 are exported)
/* sort exporteds by: | */
Config holds shared configuration values used in instantiating our server
components.
AuthValues is the set of values that could be set on the AuthHeader, in
order to bypass checks by the cache.
DBDriverstringDBHoststringDBNamestringDBPasswordstringDBPortstring
// DB host to use if first one is down
DBSecretstringDBUserstring
Ports used for hosting. 'DebugPort' is used for serving HTTP debug pages.
DisableErrorReporting disables sending errors to the GCP ErrorReporting system.
DynamicConfigLocation is the location (either a file or gs://bucket/object) for
dynamic configuration.
FallbackVersionLabel is used as the VersionLabel when not hosting on
AppEngine.
GoogleTagManagerID is the ID used for GoogleTagManager. It has the
structure GTM-XXXX.
Discovery environment variables
AppEngine identifiers
AppEngine identifiers
Minimum log level below which no logs will be printed.
Possible values are [debug, info, error, fatal].
In case of invalid/empty value, all logs will be printed.
MonitoredResource represents the resource that is running the current binary.
It might be a Google AppEngine app or a Kubernetes pod.
See https://cloud.google.com/monitoring/api/resources for more
details:
"An object representing a resource that can be used for monitoring, logging,
billing, or other purposes. Examples include virtual machine instances,
databases, and storage devices such as disks.""
Ports used for hosting. 'DebugPort' is used for serving HTTP debug pages.
AppEngine identifiers
Discovery environment variables
QueueAudience is used to allow the Cloud Tasks queue to authorize itself
to the worker. It should be the OAuth 2.0 client ID associated with the
IAP that is gating access to the worker.
QueueURL is the URL that the Cloud Tasks queue should send requests to.
It should be used when the worker is not on AppEngine.
QuotaQuotaSettings
Configuration for redis page cache.
Configuration for redis page cache.
Configuration for redis autocompletion. This is different from the page
cache instance as it has different availability requirements.
Configuration for redis autocompletion. This is different from the page
cache instance as it has different availability requirements.
ServeStats determines whether the server has an endpoint that serves statistics for
benchmarking or other purposes.
ServiceAccount is the email of the service account that this process
is running as when on GCP.
AppEngine identifiers
UseProfiler specifies whether to enable Stackdriver Profiler.
AppEngine identifiers
AppEngine identifiers
AppVersionLabel returns the version label for the current instance. This is
the AppVersionID available, otherwise a string constructed using the
timestamp of process start.
Application returns the name of the running application: "worker",
"frontend", etc.
DBConnInfo returns a PostgreSQL connection string constructed from
environment variables, using the primary database host.
DBSecondaryConnInfo returns a PostgreSQL connection string constructed from
environment variables, using the backup database host. It returns the
empty string if no backup is configured.
DebugAddr returns the network address on which to serve debugging
information.
DeploymentEnvironment returns the deployment environment this process
is in: usually one of "local", "exp", "dev", "staging" or "prod".
Dump outputs the current config information to the given Writer.
HostAddr returns the network on which to serve the primary HTTP service.
OnAppEngine reports if the current process is running in an AppEngine
environment.
OnGCP reports whether the current process is running on Google Cloud
Platform.
OnGKE reports whether the current process is running on GKE.
dbConnInfo returns a PostgresSQL connection string for the given host.
func Init(ctx context.Context) (_ *Config, err error)
func golang.org/x/pkgsite/internal/dcensus.Init(cfg *Config, views ...*view.View) error
func golang.org/x/pkgsite/internal/dcensus.NewViewExporter(cfg *Config) (_ *stackdriver.Exporter, err error)
func golang.org/x/pkgsite/internal/log.UseStackdriver(ctx context.Context, cfg *Config, logName string) (_ *logging.Logger, err error)
func golang.org/x/pkgsite/internal/queue.New(ctx context.Context, cfg *Config, queueName string, numWorkers int, expGetter middleware.ExperimentGetter, processFunc queue.inMemoryProcessFunc) (queue.Queue, error)
func golang.org/x/pkgsite/internal/worker.NewServer(cfg *Config, scfg worker.ServerConfig) (_ *worker.Server, err error)
func golang.org/x/pkgsite/cmd/internal/cmdconfig.Experimenter(ctx context.Context, cfg *Config, getter middleware.ExperimentGetter, reportingClient *errorreporting.Client) *middleware.Experimenter
func golang.org/x/pkgsite/cmd/internal/cmdconfig.ExperimentGetter(ctx context.Context, cfg *Config) middleware.ExperimentGetter
func golang.org/x/pkgsite/cmd/internal/cmdconfig.Logger(ctx context.Context, cfg *Config, logName string) middleware.Logger
func golang.org/x/pkgsite/cmd/internal/cmdconfig.OpenDB(ctx context.Context, cfg *Config, bypassLicenseCheck bool) (_ *postgres.DB, err error)
func golang.org/x/pkgsite/cmd/internal/cmdconfig.ReportingClient(ctx context.Context, cfg *Config) *errorreporting.Client
func processOverrides(cfg *Config, bytes []byte)
func golang.org/x/pkgsite/internal/dcensus.exportToStackdriver(ctx context.Context, cfg *Config)
func golang.org/x/pkgsite/internal/dcensus.stackdriverLabels(cfg *Config) *stackdriver.Labels
func golang.org/x/pkgsite/internal/queue.newGCP(cfg *Config, client *cloudtasks.Client, queueID string) (_ *queue.GCP, err error)
func golang.org/x/pkgsite/internal/worker.env(cfg *Config) string
func golang.org/x/pkgsite/cmd/worker.getCacheRedis(ctx context.Context, cfg *Config) *redis.Client
func golang.org/x/pkgsite/cmd/worker.getHARedis(ctx context.Context, cfg *Config) *redis.Client
QuotaSettings is config for internal/middleware/quota.go
AuthValues is the set of values that could be set on the AuthHeader, in
order to bypass checks by the quota server.
// maximum requests per second, per block; the size of the token bucket
Enablebool
// key for obfuscating IPs
// maximum number of entries to keep track of
// allowed queries per second, per IP block
Record data about blocking, but do not actually block.
This is a *bool, so we can distinguish "not present" from "false" in an override
func golang.org/x/pkgsite/internal/middleware.Quota(settings QuotaSettings, client *redis.Client) middleware.Middleware
Package-Level Functions (total 13, in which 5 are exported)
GetEnv looks up the given key from the environment, returning its value if
it exists, and otherwise returning the given fallback value.
GetEnvFloat64 looks up the given key from the environment and expects a
float64, returning the float64 value if it exists, and otherwise returning
the given fallback value.
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.
Init resolves all configuration values provided by the config package. It
must be called before any configuration values are used.
ValidateAppVersion validates that appVersion follows the expected format
defined by AppVersionFormat.
chooseOne selects one entry at random from a whitespace-separated
string. It returns the empty string if there are no elements.
gceMetadata reads a metadata value from GCE.
For the possible values of name, see
https://cloud.google.com/appengine/docs/standard/java/accessing-instance-metadata.
Package-Level Constants (total 7, all are exported)
AppVersionFormat is the expected format of the app version timestamp.
BypassCacheAuthHeader is the header key used by the frontend server to
know that a request can bypass cache.
BypassErrorReportingHeader is the header key used by the ErrorReporting middleware
to avoid calling the errorreporting service.
BypassQuotaAuthHeader is the header key used by the frontend server to know
that a request can bypass the quota server.
SourceTimeout is the value of the timeout for source.Client, which is used
to fetch source code from third party URLs.
StatementTimeout is the value of the Postgres statement_timeout parameter.
Statements that run longer than this are terminated.
10 minutes is the App Engine standard request timeout,
but we set this longer for the worker.
TaskIDChangeIntervalFrontend is the time period during which a given module
version can be re-enqueued to frontend tasks.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.