config

package
v0.0.0-...-803848e Latest Latest
Warning

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

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

Documentation

Overview

Package config provides functionality for working with the sidekick.toml configuration file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllSourceRoots

func AllSourceRoots(options map[string]string) []string

func SourceRoots

func SourceRoots(options map[string]string) []string

func UpdateRootConfig

func UpdateRootConfig(rootConfig *Config) error

func WriteSidekickToml

func WriteSidekickToml(outDir string, config *Config) error

Types

type Config

type Config struct {
	General GeneralConfig `toml:"general"`

	Source           map[string]string       `toml:"source,omitempty"`
	Codec            map[string]string       `toml:"codec,omitempty"`
	CommentOverrides []DocumentationOverride `toml:"documentation-overrides,omitempty"`

	// Gcloud is used to pass data into gcloud.Generate. It does not use the
	// normal .sidekick.toml file, but instead reads a gcloud.yaml file.
	Gcloud *gcloudyaml.Config
}

func LoadConfig

func LoadConfig(language string, source, codec map[string]string) (*Config, error)

LoadConfig loads the top-level configuration file and validates its contents. If no top-level file is found, falls back to the default configuration. Where applicable, overrides the top level (or default) configuration values with the ones passed in the command line. Returns the merged configuration, or an error if the top level configuration is invalid.

func LoadRootConfig

func LoadRootConfig(filename string) (*Config, error)

func MergeConfigAndFile

func MergeConfigAndFile(rootConfig *Config, filename string) (*Config, error)

type DocumentationOverride

type DocumentationOverride struct {
	ID      string `toml:"id"`
	Match   string `toml:"match"`
	Replace string `toml:"replace"`
}

Describe overrides for the documentation of a single element.

This should be used sparingly. Generally we should prefer updating the comments upstream, and then getting a new version of the services specification. The exception may be when the fixes take a long time, or are specific to one language.

type GeneralConfig

type GeneralConfig struct {
	Language            string `toml:"language,omitempty"`
	SpecificationFormat string `toml:"specification-format,omitempty"`
	SpecificationSource string `toml:"specification-source,omitempty"`
	ServiceConfig       string `toml:"service-config,omitempty"`
}

Configuration parameters that affect Parsers and Codecs, including the selection of parser and codec.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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