config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// user key files
	Libp2pPrivateKeyFileName = "libp2p_private_key"
	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"

	// update check paths
	UpdateCheckStatePath = "update.json"

	// auth paths
	TokensPath = "tokens.json"
)
View Source
const (
	ConfigFileName = "config.yaml"
	ConfigFileMode = 0666
)

Variables

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

Functions

func ClientAPIBase added in v1.2.1

func ClientAPIBase() string

func ClientAPIHost added in v1.0.4

func ClientAPIHost() string

func ClientAPIPort added in v1.0.4

func ClientAPIPort() uint16

func ClientTLSConfig added in v1.2.1

func ClientTLSConfig() types.ClientTLSConfig

func DevstackEnvFile

func DevstackEnvFile() string

func DevstackGetShouldPrintInfo

func DevstackGetShouldPrintInfo() bool

func DevstackSetShouldPrintInfo

func DevstackSetShouldPrintInfo()

func ForEnvironment added in v1.0.4

func ForEnvironment() types.BacalhauConfig

func ForKey added in v1.0.4

func ForKey(key string, cfg interface{}) error

ForKey unmarshals configuration values associated with a given key into the provided cfg structure. It uses unmarshalCompositeKey internally to handle composite keys, ensuring values spread across nested sub-keys are correctly populated into the cfg structure.

Parameters:

  • key: The configuration key to retrieve values for.
  • cfg: The structure into which the configuration values will be unmarshaled.

Returns:

  • An error if any occurred during unmarshaling; otherwise, nil.

func Get added in v1.0.4

func Get[T any](key string) (T, error)

func GetAutoCertCachePath added in v1.0.4

func GetAutoCertCachePath() string

func GetBootstrapPeers added in v1.0.4

func GetBootstrapPeers() ([]multiaddr.Multiaddr, error)

func GetClientID added in v1.0.4

func GetClientID() (string, error)

func GetClientPrivateKey added in v1.0.4

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

func GetClientPublicKey added in v1.0.4

func GetClientPublicKey() (*rsa.PublicKey, error)

func GetClientPublicKeyString added in v1.0.4

func GetClientPublicKeyString() (string, error)

GetClientPublicKeyString returns a base64-encoding of the user's public ID key: NOTE: must be called after InitConfig() or system will panic.

func GetConfig added in v1.2.2

func GetConfig() (*types.BacalhauConfig, error)

GetConfig returns the current resolved configuration from viper as a BacalhauConfig. This is the resolved configuration after all configuration sources have been merged, including the default configuration, the configuration file, environment variables, and flags.

func GetDockerManifestCacheSettings added in v1.2.1

func GetDockerManifestCacheSettings() (*types.DockerCacheConfig, error)

func GetDownloadURLRequestRetries

func GetDownloadURLRequestRetries() int

func GetDownloadURLRequestTimeout

func GetDownloadURLRequestTimeout() time.Duration

func GetEventTracerPath

func GetEventTracerPath() string

func GetExecutorPluginsPath added in v1.0.4

func GetExecutorPluginsPath() string

func GetInstallationUserID added in v1.1.3

func GetInstallationUserID() (string, error)

func GetLibp2pConfig added in v1.0.4

func GetLibp2pConfig() (types.Libp2pConfig, error)

func GetLibp2pPrivKey added in v1.0.4

func GetLibp2pPrivKey() (libp2p_crypto.PrivKey, error)

func GetLibp2pTracerPath

func GetLibp2pTracerPath() string

func GetLogMode added in v1.0.4

func GetLogMode() logger.LogMode

func GetRequesterCertificateSettings added in v1.1.0

func GetRequesterCertificateSettings() (string, string)

func GetStoragePath

func GetStoragePath() string

func GetStringMapString added in v1.0.4

func GetStringMapString(key string) map[string]string

func GetUpdateCheckFrequency added in v1.1.2

func GetUpdateCheckFrequency() time.Duration

func GetVolumeSizeRequestTimeout

func GetVolumeSizeRequestTimeout() time.Duration

func Getenv added in v1.0.4

func Getenv(key string) string

Getenv wraps os.Getenv and retrieves the value of the environment variable named by the config key. It returns the value, which will be empty if the variable is not present.

func Init added in v1.0.4

func Init(path string) (types.BacalhauConfig, error)

func KeyAsEnvVar added in v1.0.4

func KeyAsEnvVar(key string) string

KeyAsEnvVar returns the environment variable corresponding to a config key

func Load added in v1.0.4

func Load(path string) (types.BacalhauConfig, error)

func NoopConfigHandler added in v1.1.5

func NoopConfigHandler(filename string) error

func PreferredAddress added in v1.0.2

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 ReadConfigHandler added in v1.1.5

func ReadConfigHandler(fileName string) error

func Reset added in v1.0.4

func Reset()

Reset clears all configuration, useful for testing.

func ServerAPIHost added in v1.0.4

func ServerAPIHost() string

func ServerAPIPort added in v1.0.4

func ServerAPIPort() uint16

func ServerAutoCertDomain added in v1.0.4

func ServerAutoCertDomain() string

func Set added in v1.0.4

func Set(config types.BacalhauConfig) error

Set sets the configuration value. Will be used instead of values obtained via flags, config file, ENV, default. Useful for testing.

func SetDefault added in v1.1.0

func SetDefault(config types.BacalhauConfig) error

SetDefault sets the default value for the configuration. Default only used when no value is provided by the user via an explicit call to Set, flag, config file or ENV.

func SetIntallationID added in v1.1.3

func SetIntallationID(path string)

func SetUpdateCheckStatePath added in v1.1.2

func SetUpdateCheckStatePath(path string)

func SetValue added in v1.2.2

func SetValue(key string, value interface{})

SetValue sets the configuration value. This value won't be persisted in the config file. Will be used instead of values obtained via flags, config file, ENV, default.

func SetVolumeSizeRequestTimeout

func SetVolumeSizeRequestTimeout(value time.Duration)

func ShouldKeepStack

func ShouldKeepStack() bool

func WritePersistedConfigs added in v1.2.2

func WritePersistedConfigs(configFile string, resolvedCfg 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 added in v0.3.26

type DockerCredentials struct {
	Username string
	Password string
}

func GetDockerCredentials added in v0.3.26

func GetDockerCredentials() DockerCredentials

func (*DockerCredentials) IsValid added in v0.3.26

func (d *DockerCredentials) IsValid() bool

type Environment added in v1.0.4

type Environment string
const (
	// Known environments that are configured in ops/terraform:
	EnvironmentStaging Environment = "staging"
	EnvironmentProd    Environment = "production"
	EnvironmentDev     Environment = "development"
	EnvironmentTest    Environment = "test"
	EnvironmentLocal   Environment = "local"
)

func GetConfigEnvironment added in v1.0.4

func GetConfigEnvironment() Environment

func (Environment) IsKnown added in v1.0.4

func (e Environment) IsKnown() bool

func (Environment) String added in v1.0.4

func (e Environment) String() string

type Option added in v1.1.5

type Option func(options *Params)

func WithDefaultConfig added in v1.1.5

func WithDefaultConfig(cfg types.BacalhauConfig) Option

func WithFileHandler added in v1.1.5

func WithFileHandler(handler func(name string) error) Option

func WithFileName added in v1.1.5

func WithFileName(name string) Option

type Params added in v1.1.5

type Params struct {
	FileName      string
	FileHandler   func(fileName string) error
	DefaultConfig types.BacalhauConfig
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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