config

package
v0.0.0-...-ecc8568 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package config validates and gives access to ResultDB LUCI config.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Returned if configuration for a given project does not exist.
	ErrNotFoundProjectConfig = fmt.Errorf("no project config found")
)
View Source
var GCSBucketRE = regexp.MustCompile(`^[a-z0-9_\.\-]{3,222}$`)

Functions

func CreatePlaceHolderServiceConfig

func CreatePlaceHolderServiceConfig() *configpb.Config

func CreatePlaceholderProjectConfig

func CreatePlaceholderProjectConfig() *configpb.ProjectConfig

CreatePlaceholderProjectConfig creates a placeholder project config with default values.

func GetServiceConfig

func GetServiceConfig(ctx context.Context) (*configpb.Config, error)

GetServiceConfig returns the cached service-level config

func Project

func Project(ctx context.Context, project string) (*configpb.ProjectConfig, error)

Project returns the configurations of the requested project. Returns an ErrNotFoundProjectConfig error if config for the given project does not exist.

func Projects

func Projects(ctx context.Context) (map[string]*configpb.ProjectConfig, error)

Projects returns all project configurations, in a map by project name. Uses in-memory cache to avoid hitting datastore all the time. Note that the config may be stale by up to 1 minute.

func SetServiceConfig

func SetServiceConfig(ctx context.Context, cfg *configpb.Config) error

SetServiceConfig installs the service into the context ctx. This is only used for the purpose of testing.

func SetTestProjectConfig

func SetTestProjectConfig(ctx context.Context, cfg map[string]*configpb.ProjectConfig) error

SetTestProjectConfig sets test project configuration in datastore. It should be used from unit/integration tests only.

func UpdateConfig

func UpdateConfig(ctx context.Context) error

UpdateConfig is called from a cron periodically; it fetches the latest service-wide config and project config from the LUCI Config service and caches them into the datastore

func UpdateProjects

func UpdateProjects(ctx context.Context) error

UpdateProjects fetches fresh project-level configuration from LUCI Config service and stores it in datastore.

func UpdateServiceConfig

func UpdateServiceConfig(ctx context.Context) error

UpdateServiceConfig fetches the latest service config and caches it in datastore.

Types

This section is empty.

Jump to

Keyboard shortcuts

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