cfgmodule

package
v0.0.0-...-efe69f1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 20 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 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