config

package
v1.2.161 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultSourceKind = SourceKind("default")
	EnvSourceKind     = SourceKind("env")
	FileSourceKind    = SourceKind("file")
	ArgSourceKind     = SourceKind("arg")
	TokenSourceKind   = SourceKind("service")
	EmptySourceKind   = SourceKind("empty")
)
View Source
var ChalkIgnore = ".chalkignore"
View Source
var DefaultRequirements = "requirements.txt"

Functions

This section is empty.

Types

type ClientId

type ClientId string

type ClientSecret

type ClientSecret string

type EnvironmentId added in v1.2.97

type EnvironmentId string

type EnvironmentSettings added in v1.2.105

type EnvironmentSettings struct {
	Runtime         *string `json:"runtime,omitempty" yaml:"runtime,omitempty"`
	PlatformVersion *string `json:"platform_version,omitempty" yaml:"platform_version,omitempty"`
	Requirements    *string `json:"requirements,omitempty" yaml:"requirements,omitempty"`
	Dockerfile      *string `json:"dockerfile,omitempty" yaml:"dockerfile,omitempty"`
}

func (*EnvironmentSettings) ToProto added in v1.2.105

type JWT

type JWT struct {
	Token      string    `yaml:"value"`
	ValidUntil time.Time `yaml:"validUntil"`
}

type Manager

type Manager struct {
	ClientId      SourcedConfig[ClientId]
	ClientSecret  SourcedConfig[ClientSecret]
	EnvironmentId SourcedConfig[string]
	Scope         SourcedConfig[string]
	// contains filtered or unexported fields
}

func NewManager

func NewManager(ctx context.Context, inputs *ManagerInputs) (*Manager, error)

func (*Manager) GetAPIServer added in v1.2.104

func (m *Manager) GetAPIServer() SourcedConfig[string]

func (*Manager) GetGRPCQueryServer added in v1.2.104

func (m *Manager) GetGRPCQueryServer() SourcedConfig[string]

func (*Manager) GetJSONQueryServer added in v1.2.104

func (m *Manager) GetJSONQueryServer() SourcedConfig[string]

func (*Manager) SetAPIServer added in v1.2.104

func (m *Manager) SetAPIServer(server SourcedConfig[string])

func (*Manager) SetGRPCQueryServer added in v1.2.104

func (m *Manager) SetGRPCQueryServer(server SourcedConfig[string])

func (*Manager) SetJSONQueryServer added in v1.2.104

func (m *Manager) SetJSONQueryServer(server SourcedConfig[string])

type ManagerInputs added in v1.2.97

type ManagerInputs struct {
	APIServer       string
	GRPCQueryServer string
	JSONQueryServer string
	ClientId        ClientId
	ClientSecret    ClientSecret
	EnvironmentId   string
	Scope           string
	ConfigDir       *string
}

type ProjectSettings added in v1.2.105

type ProjectSettings struct {
	Project        string                          `json:"project" yaml:"project"`
	Environments   map[string]*EnvironmentSettings `json:"environments" yaml:"environments"`
	LocalDirectory string                          `json:"localDirectory" yaml:"localDirectory,omitempty"`
	ChalkIgnore    *string                         `json:"chalkIgnore,omitempty" yaml:"chalkIgnore,omitempty"`
	Filename       string                          `yaml:"filename,omitempty"`
}

func LoadProjectConfig added in v1.2.126

func LoadProjectConfig(ctx context.Context) (*ProjectSettings, error)

func (*ProjectSettings) ToProto added in v1.2.105

func (settings *ProjectSettings) ToProto() *artifactsv1.ProjectSettings

type ProjectToken

type ProjectToken struct {
	Name              string       `yaml:"name"`
	ClientId          ClientId     `yaml:"clientId"`
	ClientSecret      ClientSecret `yaml:"clientSecret"`
	ValidUntil        string       `yaml:"validUntil"`
	ApiServer         string       `yaml:"apiServer"`
	ActiveEnvironment string       `yaml:"activeEnvironment"`
	JWT               JWT          `yaml:"jwt,omitempty"`
}

func GetProjectAuthConfig

func GetProjectAuthConfig(ctx context.Context, configDir *string) (*ProjectToken, string, error)

type ProjectTokens

type ProjectTokens struct {
	Tokens map[string]*ProjectToken `yaml:"tokens,omitempty"`
}

type SourceKind added in v1.2.97

type SourceKind string

type SourcedConfig

type SourcedConfig[T SourcedValueT] struct {
	Value  T
	Source string
	Kind   SourceKind
}

SourcedConfig represents a configuration value along with information about where it came from

func AddScheme added in v1.2.104

func GetFirstNonEmpty

func GetFirstNonEmpty[T SourcedValueT](configs ...SourcedConfig[T]) SourcedConfig[T]

GetFirstNonEmpty returns the first non-empty SourcedConfig from the provided list using the provided zero-check function

func NewFromArg

func NewFromArg[T SourcedValueT](value T) SourcedConfig[T]

NewFromArg creates a SourcedConfig from a direct argument

func NewFromDefault added in v1.2.97

func NewFromDefault[T SourcedValueT](value T, desc string) SourcedConfig[T]

func NewFromEnvVar

func NewFromEnvVar[T ~string](ctx context.Context, key string) SourcedConfig[T]

func NewFromFile

func NewFromFile[T SourcedValueT](path string, value T) SourcedConfig[T]

NewFromFile creates a SourcedConfig from a config file

func NewFromToken added in v1.2.97

func NewFromToken[T SourcedValueT](value T, description string) SourcedConfig[T]

func (SourcedConfig[T]) WithSource added in v1.2.97

func (c SourcedConfig[T]) WithSource(source string) SourcedConfig[T]

func (SourcedConfig[T]) WithSourceF added in v1.2.97

func (c SourcedConfig[T]) WithSourceF(source string, args ...any) SourcedConfig[T]

func (SourcedConfig[T]) WithValue added in v1.2.97

func (c SourcedConfig[T]) WithValue(value T) SourcedConfig[T]

type SourcedValueT

type SourcedValueT interface {
	~int | ~int64 | ~float32 | ~float64 | ~string
}

Jump to

Keyboard shortcuts

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