config

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

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

Documentation

Overview

Package config contains all code for managing Milo's global service configuration.

Not to be confused with projectconfig, which manages configurations for projects supported by Milo (e.g. ChromeOS, Chromium).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSettings

func GetSettings(c context.Context) *configpb.Settings

GetSettings returns the service (aka global) config for the current instance of Milo from the datastore. Returns an empty config and warn heavily if none is found. TODO(hinoka): Use process cache to cache configs.

func UpdateConfigHandler

func UpdateConfigHandler(c context.Context) error

UpdateConfigHandler is an HTTP handler that handles configuration update requests.

func UpdateServiceConfig

func UpdateServiceConfig(c context.Context) (*configpb.Settings, error)

UpdateServiceConfig fetches the service config from luci-config and then stores a snapshot of the configuration in datastore.

Types

type ServiceConfig

type ServiceConfig struct {
	// ID is the datastore key.  This should be static, as there should only be
	// one service config.
	ID string `gae:"$id"`
	// Revision is the revision of the config, taken from luci-config.  This is used
	// to determine if the entry needs to be refreshed.
	Revision string
	// Data is the binary proto of the config.
	Data []byte `gae:",noindex"`
	// Text is the text format of the config.  For human consumption only.
	Text string `gae:",noindex"`
	// LastUpdated is the time this config was last updated.
	LastUpdated time.Time
}

ServiceConfig is a container for the instance's service config.

func GetCurrentServiceConfig

func GetCurrentServiceConfig(c context.Context) (*ServiceConfig, error)

GetCurrentServiceConfig gets the service config for the instance from either process cache or datastore cache.

Jump to

Keyboard shortcuts

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