cfgmodule

package
v0.0.0-...-ef45db5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 26 Imported by: 9

Documentation

Overview

Package cfgmodule provides a server module with a LUCI Config client.

It installs a LUCI Config client implementation into the context and registers config validation endpoints.

Index

Constants

This section is empty.

Variables

View Source
var ModuleName = module.RegisterName("go.chromium.org/luci/config/server/cfgmodule")

ModuleName can be used to refer to this module when declaring dependencies.

Functions

func InstallHandlers deprecated

func InstallHandlers(r *router.Router, base router.MiddlewareChain, rules *validation.RuleSet)

InstallHandlers installs the metadata and validation handlers that use the given validation rules.

It does not implement any authentication checks, thus the passed in router.MiddlewareChain should implement any necessary authentication checks.

Deprecated: The handlers are called by the legacy LUCI Config service. The new LUCI Config service will make request to `cfgpb.Consumer` prpc service instead. See `consumerServer`.

func NewModule

func NewModule(opts *ModuleOptions) module.Module

NewModule returns a server module that exposes LUCI Config validation endpoints.

func NewModuleFromFlags

func NewModuleFromFlags() module.Module

NewModuleFromFlags is a variant of NewModule that initializes options through command line flags.

Calling this function registers flags in flag.CommandLine. They are usually parsed in server.Main(...).

Types

type ConsumerServer

type ConsumerServer struct {
	cfgpb.UnimplementedConsumerServer
	// Rules is a rule set to use for the config validation.
	Rules *validation.RuleSet
	// GetConfigServiceAccountFn returns a function that can fetch the service
	// account of the LUCI Config service. It is used by ACL checking.
	GetConfigServiceAccountFn func(context.Context) (string, error)
}

ConsumerServer implements `cfgpb.Consumer` interface that will be called by LUCI Config.

func (*ConsumerServer) GetMetadata

func (srv *ConsumerServer) GetMetadata(ctx context.Context, _ *emptypb.Empty) (*cfgpb.ServiceMetadata, error)

GetMetadata implements cfgpb.Consumer.GetMetadata.

func (*ConsumerServer) ValidateConfigs

ValidateConfigs implements cfgpb.Consumer.ValidateConfigs.

type ModuleOptions

type ModuleOptions struct {
	// ServiceHost is a hostname of a LUCI Config service to use.
	//
	// If given, indicates configs should be fetched from the LUCI Config service.
	// Not compatible with LocalDir.
	ServiceHost string

	// LocalDir is a file system directory to fetch configs from instead of
	// a LUCI Config service.
	//
	// See https://godoc.org/go.chromium.org/luci/config/impl/filesystem for the
	// expected layout of this directory.
	//
	// Useful when running locally in development mode. Not compatible with
	// ServiceHost.
	LocalDir string

	// Vars is a var set to use to render config set names.
	//
	// If nil, the module uses global &vars.Vars. This is usually what you want.
	//
	// During the initialization the module registers the following vars:
	//   ${appid}: value of -cloud-project server flag.
	//   ${config_service_appid}: app ID of the LUCI Config service.
	Vars *vars.VarSet

	// Rules is a rule set to use for the config validation.
	//
	// If nil, the module uses global &validation.Rules. This is usually what
	// you want.
	Rules *validation.RuleSet
}

ModuleOptions contain configuration of the LUCI Config server module.

func (*ModuleOptions) Register

func (o *ModuleOptions) Register(f *flag.FlagSet)

Register registers the command line flags.

Jump to

Keyboard shortcuts

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