luci: Index | Files

package config

import ""


Package Files

config.go projects.go settings.go


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

func ActiveProjects Uses

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

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

The list will be alphabetically sorted.

func ActiveUserProjects Uses

func ActiveUserProjects(c context.Context) ([]string, 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 Uses

func ProjectConfig(c context.Context, project string) (*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 Uses

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 Uses

func ProjectNames(c context.Context, a cfgclient.Authority) ([]string, error)

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

func ServiceConfigPath Uses

func ServiceConfigPath(c context.Context) (config.Set, string)

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

type Config Uses

type Config struct {
    // 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 config.Set `json:"-"`
    // ServiceConfigPath is the path within ConfigSet of the service
    // configuration.
    ServiceConfigPath string `json:"-"`

Config is the LogDog Coordinator service configuration.

func Load Uses

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 Uses

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 Uses

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 Uses

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

Store stores the new global configuration.

func (Settings) Validate Uses

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.

Package config imports 11 packages (graph) and is imported by 8 packages. Updated 2020-04-07. Refresh now. Tools for package owners.