Documentation ¶
Overview ¶
This package governs metadata in configuration repos and their surrounding development repositories as well.
Metadata refers to a yaml file that provides information about how to parse and interact with the referenced configuration files.
ConfigRepo or configuration repository refers to the source of truth repository.
DevRepo or development repository refers to the repository where lekko config is used, but not as a source of truth.
Index ¶
- Constants
- func CreateNamespaceMetadata(ctx context.Context, rootPath, namespaceName string, cw fs.ConfigWriter) error
- func MarshalYAML(v interface{}) ([]byte, error)
- func NewSecrets(homeDir string) *secrets
- func NewSecretsOrError() (*secrets, error)
- func NewSecretsOrFail() *secrets
- func NewYAMLDecoderStrict(reader io.Reader) *yaml.Decoder
- func NewYAMLEncoderStrict(writer io.Writer) *yaml.Encoder
- func UnmarshalYAMLStrict(data []byte, v interface{}) error
- func UpdateRootConfigRepoMetadata(ctx context.Context, path string, cw fs.ConfigWriter, ...) error
- type NamespaceConfigRepoMetadata
- type RootConfigRepoMetadata
- type Secrets
Constants ¶
const AuthenticateGituhubMessage = "User is not authenticated.\nRun 'lekko auth login' to authenticate with GitHub."
const DefaultNamespaceConfigRepoMetadataFileName = "lekko.ns.yaml"
const DefaultRootConfigRepoMetadataFileName = "lekko.root.yaml"
const GenFolderPathJSON = "gen/json"
const GenFolderPathProto = "gen/proto"
const LatestNamespaceVersion = "v1beta3"
Variables ¶
This section is empty.
Functions ¶
func CreateNamespaceMetadata ¶
func MarshalYAML ¶
func NewSecrets ¶
func NewSecrets(homeDir string) *secrets
Instantiates new secrets, attempting to read from local disk if available. NOTE: always defer *Secrets.Close after calling this method.
func NewSecretsOrError ¶
func NewSecretsOrError() (*secrets, error)
func NewSecretsOrFail ¶
func NewSecretsOrFail() *secrets
func NewYAMLDecoderStrict ¶
NewYAMLDecoderStrict creates a new YAML decoder from the reader.
func NewYAMLEncoderStrict ¶
NewYAMLDecoderStrict creates a new YAML decoder from the reader.
func UnmarshalYAMLStrict ¶
This is taken from github.com/bufbuild/buf/private/pkg/encoding/encoding.go
UnmarshalYAMLStrict unmarshals the data as YAML, returning a user error on failure.
If the data length is 0, this is a no-op.
func UpdateRootConfigRepoMetadata ¶
func UpdateRootConfigRepoMetadata(ctx context.Context, path string, cw fs.ConfigWriter, f func(*RootConfigRepoMetadata)) error
Types ¶
type NamespaceConfigRepoMetadata ¶
type NamespaceConfigRepoMetadata struct { // This version refers to the version of the configuration in the repo itself. // TODO we should move this to a separate version number. Version string `json:"version,omitempty" yaml:"version,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` }
type RootConfigRepoMetadata ¶
type RootConfigRepoMetadata struct { // This version refers to the version of the metadata. Version string `json:"version,omitempty" yaml:"version,omitempty"` Namespaces []string `json:"namespaces,omitempty" yaml:"namespaces,omitempty"` ProtoDirectory string `json:"protoDir,omitempty" yaml:"protoDir,omitempty"` }
The type for
func ParseFullConfigRepoMetadataStrict ¶
func ParseFullConfigRepoMetadataStrict(ctx context.Context, path string, provider fs.Provider) (*RootConfigRepoMetadata, map[string]*NamespaceConfigRepoMetadata, error)
Parses the lekko metadata from a configuration repo in a strict way, returning a user error on failure.
This looks in the default locations and names for now, and a custom extension can be written later.
This returns the root metadata of a repository and a map from namespace name to namespace metadata.
This takes a provider so that we can use the same code on a local version on disk as well as in Github.
type Secrets ¶
type Secrets interface { GetGithubToken() string SetGithubToken(token string) GetGithubUser() string SetGithubUser(user string) GetGithubEmail() string SetGithubEmail(email string) HasGithubToken() bool Close() error }
Secrets holds all the user-specific information that needs to exist for the cli to work, but should not live in a shared config repo. For instance, it holds the github auth token. The secrets are backed by the filesystem under the user's home directory, so these secrets don't need to be fetched as part of every cli command.