config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config handles application configuration loading and validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveDefaultConfig

func SaveDefaultConfig(configPath string) error

SaveDefaultConfig writes a default JSON configuration file to the given path.

Types

type AWSConfig

type AWSConfig struct {
	Region          string `json:"region"`
	AccessKeyID     string `json:"accessKeyId"`
	SecretAccessKey string `json:"secretAccessKey"`
	Endpoint        string `json:"endpoint,omitempty"`
	DisableSSL      bool   `json:"disableSSL,omitempty"`
}

AWSConfig contains settings for AWS S3 provider.

type AzureConfig

type AzureConfig struct {
	AccountName string `json:"accountName"`
	AccountKey  string `json:"accountKey"`
	EndpointURL string `json:"endpointUrl,omitempty"`
}

AzureConfig contains settings for Azure Blob Storage provider.

type BucketMapping

type BucketMapping struct {
	SourceProviderID string `json:"sourceProviderId"`
	SourceBucket     string `json:"sourceBucket"`
	TargetProviderID string `json:"targetProviderId"`
	TargetBucket     string `json:"targetBucket"`
}

BucketMapping defines a source-to-target bucket mapping for synchronization.

type Config

type Config struct {
	DatabasePath string           `json:"databasePath"`
	Providers    []ProviderConfig `json:"providers"`
	Mappings     []BucketMapping  `json:"mappings"`
}

Config represents the application configuration including database path, storage providers, and bucket mappings.

func LoadConfig

func LoadConfig(configPath string) (*Config, error)

LoadConfig reads a JSON configuration file from the provided path, fills default values, and validates the resulting Config.

type GCSConfig

type GCSConfig struct {
	ProjectID string `json:"projectId"`
}

GCSConfig contains settings for Google Cloud Storage provider.

type MinIOConfig

type MinIOConfig struct {
	Endpoint  string `json:"endpoint"`
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
	UseSSL    bool   `json:"useSSL"`
	Region    string `json:"region,omitempty"`
}

MinIOConfig contains settings for MinIO (S3-compatible) provider.

type ProviderConfig

type ProviderConfig struct {
	ID    string       `json:"id"`
	Type  ProviderType `json:"type"`
	GCS   *GCSConfig   `json:"gcs,omitempty"`
	AWS   *AWSConfig   `json:"aws,omitempty"`
	Azure *AzureConfig `json:"azure,omitempty"`
	MinIO *MinIOConfig `json:"minio,omitempty"`
}

ProviderConfig holds configuration for a specific storage provider.

type ProviderType

type ProviderType string
const (
	GCS   ProviderType = "gcs"
	AWS   ProviderType = "aws"
	AZURE ProviderType = "azure"
	MINIO ProviderType = "minio"
)

Jump to

Keyboard shortcuts

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