config_legacy

package
v1.5.0-dev14 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileName = "config.yaml"

	// user key files
	UserPrivateKeyFileName = "user_id.pem"

	// compute paths
	ComputeStoragesPath = "executor_storages"
	ComputeStorePath    = "compute_store"
	PluginsPath         = "plugins"

	// orchestrator paths
	OrchestratorStorePath = "orchestrator_store"
	AutoCertCachePath     = "autocert-cache"
	NetworkTransportStore = "nats-store"

	// auth paths
	TokensPath = "tokens.json"
)
View Source
const (
	DockerUsernameEnvVar = "DOCKER_USERNAME"
	DockerPasswordEnvVar = "DOCKER_PASSWORD"
)

Variables

View Source
var (
	ComputeExecutionsStorePath = filepath.Join(ComputeStorePath, "executions.db")
	OrchestratorJobStorePath   = filepath.Join(OrchestratorStorePath, "jobs.db")

	DecoderHook = viper.DecodeHook(mapstructure.TextUnmarshallerHookFunc())
)

Functions

func DevstackEnvFile

func DevstackEnvFile() string

func DevstackGetShouldPrintInfo

func DevstackGetShouldPrintInfo() bool

func DevstackSetShouldPrintInfo

func DevstackSetShouldPrintInfo()

func GetClientID

func GetClientID(path string) (string, error)

func GetClientPrivateKey

func GetClientPrivateKey(path string) (*rsa.PrivateKey, error)

func KeyAsEnvVar

func KeyAsEnvVar(key string) string

KeyAsEnvVar returns the environment variable corresponding to a config key

func New

func New(opts ...Option) (*config, error)

New returns a configuration with the provided options applied. If no options are provided, the returned config contains only the default values.

func PreferredAddress

func PreferredAddress() string

PreferredAddress will allow for the specifying of the preferred address to listen on for cases where it is not clear, or where the address does not appear when using 0.0.0.0

func ShouldKeepStack

func ShouldKeepStack() bool

func WritePersistedConfigs

func WritePersistedConfigs(configFilePath string, cfg types.BacalhauConfig) error

WritePersistedConfigs will write certain values from the resolved config to the persisted config. These include fields for configurations that must not change between version updates, such as the execution store and job store paths, in case we change their default values in future updates.

Types

type DockerCredentials

type DockerCredentials struct {
	Username string
	Password string
}

func GetDockerCredentials

func GetDockerCredentials() DockerCredentials

func (*DockerCredentials) IsValid

func (d *DockerCredentials) IsValid() bool

type Option

type Option = func(s *config)

func WithDefault

func WithDefault(cfg types.BacalhauConfig) Option

WithDefault sets the default config to be used when no values are provided.

func WithEnvironmentVariables

func WithEnvironmentVariables(ev map[string][]string) Option

func WithFlags

func WithFlags(flags map[string]*pflag.Flag) Option

func WithPaths

func WithPaths(path ...string) Option

WithPaths sets paths to configuration files to be loaded paths to configuration files merged from [0] to [N] e.g. file at index 1 overrides index 0, index 2 overrides index 1 and 0, etc.

func WithValues

func WithValues(values map[string]any) Option

WithValues sets values to be injected into the config, taking precedence over all other options.

type ReadWriter

type ReadWriter interface {
	Reader
	Writer
}

type Reader

type Reader interface {
	Current() (types.BacalhauConfig, error)
}

type Writer

type Writer interface {
	Set(key string, value interface{})
	SetIfAbsent(key string, value interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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