initialize

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeConfig

func InitializeConfig(ctx context.Context, storageProfileFile, apiKeysFile string, qtx *configdb.Queries, replace bool) error

InitializeConfig loads and imports storage profiles and API keys

func InitializeConfigWithDependencies

func InitializeConfigWithDependencies(ctx context.Context, storageProfileFile, apiKeysFile string, qtx DatabaseQueries, fileReader FileReader, replace bool) error

InitializeConfigWithDependencies loads and imports with injectable dependencies for testing

func LoadFileContentsWithReader added in v1.3.4

func LoadFileContentsWithReader(filename string, fileReader FileReader) ([]byte, error)

LoadFileContentsWithReader loads file contents using the provided FileReader

func UnmarshalYAML added in v1.3.4

func UnmarshalYAML(data []byte, v interface{}) error

UnmarshalYAML unmarshals YAML data into the provided interface

Types

type APIKeyOrg

type APIKeyOrg struct {
	OrganizationID uuid.UUID `yaml:"organization_id"`
	Keys           []string  `yaml:"keys"`
}

type APIKeysConfig

type APIKeysConfig []APIKeyOrg

API Keys configuration

type DatabaseQueries

type DatabaseQueries interface {
	HasExistingStorageProfiles(ctx context.Context) (bool, error)
	UpsertBucketConfiguration(ctx context.Context, arg configdb.UpsertBucketConfigurationParams) (configdb.BucketConfiguration, error)
	UpsertOrganizationBucket(ctx context.Context, arg configdb.UpsertOrganizationBucketParams) error
	UpsertOrganization(ctx context.Context, arg configdb.UpsertOrganizationParams) (configdb.Organization, error)
	ClearOrganizationAPIKeyMappings(ctx context.Context) error
	ClearOrganizationAPIKeys(ctx context.Context) error
	UpsertOrganizationAPIKey(ctx context.Context, arg configdb.UpsertOrganizationAPIKeyParams) (configdb.OrganizationApiKey, error)
	UpsertOrganizationAPIKeyMapping(ctx context.Context, arg configdb.UpsertOrganizationAPIKeyMappingParams) error
}

DatabaseQueries interface for testable database operations

type FileReader

type FileReader interface {
	ReadFile(filename string) ([]byte, error)
	Getenv(key string) string
}

FileReader interface for testable file operations

type OSFileReader

type OSFileReader struct{}

OSFileReader implements FileReader using OS operations

func (OSFileReader) Getenv

func (r OSFileReader) Getenv(key string) string

func (OSFileReader) ReadFile

func (r OSFileReader) ReadFile(filename string) ([]byte, error)

type StorageProfile

type StorageProfile struct {
	OrganizationID uuid.UUID `yaml:"organization_id"`
	InstanceNum    int       `yaml:"instance_num,omitempty"`   // Defaults to 1 if not specified
	CollectorName  string    `yaml:"collector_name,omitempty"` // Defaults to "default" if not specified
	CloudProvider  string    `yaml:"cloud_provider"`
	Region         string    `yaml:"region"`
	Bucket         string    `yaml:"bucket"`
	Role           string    `yaml:"role,omitempty"`
	Endpoint       string    `yaml:"endpoint,omitempty"`
	UsePathStyle   bool      `yaml:"use_path_style,omitempty"`
	InsecureTLS    bool      `yaml:"insecure_tls,omitempty"`
}

StorageProfile represents the YAML structure for storage profile initialization

Jump to

Keyboard shortcuts

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