Documentation ¶
Overview ¶
Package common holds the shared functionalities across config_service.
Index ¶
- Constants
- func CreateSignedURLs(ctx context.Context, gsClient clients.GsClient, paths []gs.Path, method string, ...) ([]string, error)
- func DistributeOffset(interval time.Duration, keyParts ...string) time.Duration
- func GetSelfSignedJWTTransport(ctx context.Context, aud string) (http.RoundTripper, error)
- func GitilesURL(loc *cfgcommonpb.GitilesLocation) string
- func LoadSelfConfig[T proto.Message](ctx context.Context, fileName string, configMsg T) error
- func ValidateGitilesLocation(loc *cfgcommonpb.GitilesLocation) error
Constants ¶
const ( // ACLRegistryFilePath is the path of luci-config self config file where // it stores the service ACL configurations. ACLRegistryFilePath = "acl.cfg" // ProjRegistryFilePath is the path of luci-config self config file where it // stores a list of registered projects. ProjRegistryFilePath = "projects.cfg" // ProjMetadataFilePath is the path where project metadata config for each // LUCI Project. ProjMetadataFilePath = "project.cfg" // ServiceRegistryFilePath is the path of luci-config self config file where // it stores a list of registered services. ServiceRegistryFilePath = "services.cfg" // ImportConfigFilePath is the path of luci-config self config file where it // stores config about importing from external source. ImportConfigFilePath = "import.cfg" // SchemaConfigFilePath is the path of luci-config self config file where // it stores config to support schema redirection. SchemaConfigFilePath = "schemas.cfg" // GSProdCfgFolder is the folder name where it stores all production configs // in GCS bucket. GSProdCfgFolder = "configs" // GSValidationCfgFolder is the folder name where it stores all configs // for ad-hoc validation in GCS bucket. GSValidationCfgFolder = "validation" // ConfigMaxSize is the maximum size of the config LUCI Config supports. ConfigMaxSize = 200 * 1024 * 1024 // 200 MiB )
Variables ¶
This section is empty.
Functions ¶
func CreateSignedURLs ¶
func CreateSignedURLs(ctx context.Context, gsClient clients.GsClient, paths []gs.Path, method string, headers map[string]string) ([]string, error)
CreateSignedURLs create signed urls for the given GS paths.
Uses the service account the service currently runs as to authorize and sign the urls.
func DistributeOffset ¶
DistributeOffset deterministically chooses an offset across keys in [1..interval) range aiming for uniform distribution across all keys.
A key is simply a concatenation of key parts with '\0' filler in between.
Shamelessly copied from: https://chromium.googlesource.com/infra/luci/luci-go/+/HEAD/cv/internal/common/project_distribuition.go TODO(yiwzhang): Consider move to a common packages in luci-go.
func GetSelfSignedJWTTransport ¶
GetSelfSignedJWTTransport returns a transport that add self signed jwt token as authorization header.
func GitilesURL ¶
func GitilesURL(loc *cfgcommonpb.GitilesLocation) string
GitilesURL assembles a URL from the given gitiles location. Note: it doesn't validate the format of GitilesLocation.
func LoadSelfConfig ¶
LoadSelfConfig reads LUCI Config self config and parse it to the provided message.
Return model.NoSuchConfigError if the provided config file can not be found.
func ValidateGitilesLocation ¶
func ValidateGitilesLocation(loc *cfgcommonpb.GitilesLocation) error
ValidateGitilesLocation validate cfgcommonpb.GitilesLocation proto.
Types ¶
This section is empty.