config

package
v0.0.0-...-678bb0e Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidConfig is returned when the configuration exists, but is invalid.
	ErrInvalidConfig = errors.New("invalid configuration")
)

Functions

func ActiveProjects

func ActiveProjects(c context.Context) ([]cfgtypes.ProjectName, error)

ActiveProjects returns a full list of all config service projects with LogDog project configurations.

The list will be alphabetically sorted.

func ActiveUserProjects

func ActiveUserProjects(c context.Context) ([]cfgtypes.ProjectName, error)

ActiveUserProjects returns a full list of all config service projects with LogDog project configurations that the current user can see.

The list will be alphabetically sorted.

func ProjectConfig

func ProjectConfig(c context.Context, project cfgtypes.ProjectName) (*svcconfig.ProjectConfig, error)

ProjectConfig loads the project config protobuf from the config service.

This function will return:

  • nil, if the project exists and the configuration successfully loaded
  • config.ErrNoConfig if the project configuration was not present.
  • ErrInvalidConfig if the project configuration was present, but could not be loaded.
  • Some other error if an error occurred that does not fit one of the previous categories.

func ProjectConfigPath

func ProjectConfigPath(c context.Context) string

ProjectConfigPath returns the path of the project-specific configuration. This path should be used with a project config set.

A given project's configuration is named after the current App ID.

func ProjectNames

ProjectNames returns a sorted list of the names of all of the projects that the supplied authority can view.

func ServiceConfigPath

func ServiceConfigPath(c context.Context) (cfgtypes.ConfigSet, string)

ServiceConfigPath returns the config set and path for this application's service configuration.

Types

type Config

type Config struct {
	svcconfig.Config
	// Settings are per-instance settings.
	Settings Settings

	// ConfigServiceURL is the config service's URL.
	ConfigServiceURL url.URL `json:"-"`
	// ConfigSet is the name of the service config set that is being used.
	ConfigSet cfgtypes.ConfigSet `json:"-"`
	// ServiceConfigPath is the path within ConfigSet of the service
	// configuration.
	ServiceConfigPath string `json:"-"`
}

Config is the LogDog Coordinator service configuration.

func Load

func Load(c context.Context) (*Config, error)

Load loads the service configuration. This includes:

  • The config service settings.
  • The service configuration, loaded from the config service.
  • Additional Settings data from datastore via settings.

The service config is minimally validated prior to being returned.

type Settings

type Settings struct {
	// BigTableServiceAccountJSON, if not empty, is the service account JSON file
	// data that will be used for BigTable access.
	//
	// TODO(dnj): Remove this option once Cloud BigTable has cross-project ACLs.
	BigTableServiceAccountJSON []byte `json:"bigTableServiceAccountJson"`
}

Settings is the LogDog Coordinator auxiliary (runtime) settings. These are stored within a given datastore instance, rather than in luci-config, due to their sensitivity.

func (*Settings) Load

func (s *Settings) Load(c context.Context) error

Load populates the settings instance from the stored settings.

If no settings are stored, an empty Settings instance will be loaded and this will return nil.

An error will be returned if an operation that is expected to succeed fails.

func (*Settings) Store

func (s *Settings) Store(c context.Context, why string) error

Store stores the new global configuration.

func (Settings) Validate

func (s Settings) Validate() error

Validate validates the correctness of this configuration, returning an error if it's invalid.

Note that only the contents saved to settings are validated. The read-only configuration is not.

Jump to

Keyboard shortcuts

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