config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	S3Prefix        = "s3://"
	GCSPrefix       = "gs://"
	AzurePrefix     = "azblob://"
	FilePrefix      = "file:///"
	DRSPrefix       = "drs://"
	DefaultS3Region = "us-east-1"

	DefaultSigningExpirySeconds = 900 // 15 minutes

	// --- Route Constants ---
	RouteHealthz = "/healthz"

	// LFS
	RouteLFSBatch    = "/info/lfs/objects/batch"
	RouteLFSMetadata = "/info/lfs/objects/metadata"
	RouteLFSObject   = "/info/lfs/objects/{oid}"
	RouteLFSVerify   = "/info/lfs/verify"

	// Metrics
	RouteMetricsFiles      = "/index/v1/metrics/files"
	RouteMetricsFileDetail = "/index/v1/metrics/files/{object_id}"
	RouteMetricsSummary    = "/index/v1/metrics/summary"

	// Docs
	RouteSwaggerUI    = "/index/swagger"
	RouteSwaggerUIAlt = "/index/swagger/"
	RouteOpenAPISpec  = "/index/openapi.yaml"
	RouteLFSSpec      = "/index/openapi-lfs.yaml"
	RouteBucketSpec   = "/index/openapi-bucket.yaml"
	RouteInternalSpec = "/index/openapi-internal.yaml"

	// Internal DRS Data
	RouteInternalDownload          = "/data/download/{file_id}"
	RouteInternalDownloadPart      = "/data/download/{file_id}/part"
	RouteInternalUpload            = "/data/upload"
	RouteInternalUploadURL         = "/data/upload/{file_id}"
	RouteInternalUploadBulk        = "/data/upload/bulk"
	RouteInternalMultipartInit     = "/data/multipart/init"
	RouteInternalMultipartUpload   = "/data/multipart/upload"
	RouteInternalMultipartComplete = "/data/multipart/complete"
	RouteInternalBuckets           = "/data/buckets"
	RouteInternalBucketDetail      = "/data/buckets/{bucket}"
	RouteInternalBucketScopes      = "/data/buckets/{bucket}/scopes"

	// Internal DRS Index
	RouteInternalIndex            = "/index"
	RouteInternalIndexDetail      = "/index/{id}"
	RouteInternalBulkHashes       = "/index/bulk/hashes"
	RouteInternalBulkDeleteHashes = "/index/bulk/delete"
	RouteInternalBulkSHA256       = "/index/bulk/sha256/validity"
	RouteInternalBulkCreate       = "/index/bulk"
	RouteInternalBulkDocs         = "/index/bulk/documents"

	// Core API
	RouteCoreSHA256 = "/index/v1/sha256/validity"
)
View Source
const (
	AuthModeLocal = "local"
	AuthModeGen3  = "gen3"
)
View Source
const (
	DefaultLFSMaxBatchObjects                    = 1000
	DefaultLFSMaxBatchBodyBytes            int64 = 10 * 1024 * 1024 // 10 MiB
	DefaultLFSRequestLimitPerMinute              = 1200             // 20 req/sec average per client
	DefaultLFSBandwidthLimitBytesPerMinute int64 = 0                // disabled by default
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Mode  string          `json:"mode" yaml:"mode"`
	Basic BasicAuthConfig `json:"basic" yaml:"basic"`
}

type BasicAuthConfig

type BasicAuthConfig struct {
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

type Config

type Config struct {
	Port          int            `json:"port" yaml:"port"`
	Database      DatabaseConfig `json:"database" yaml:"database"`
	S3Credentials []S3Config     `json:"s3_credentials" yaml:"s3_credentials"`
	Auth          AuthConfig     `json:"auth" yaml:"auth"`
	LFS           LFSConfig      `json:"lfs" yaml:"lfs"`
	Signing       SigningConfig  `json:"signing" yaml:"signing"`
}

func LoadConfig

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

type DatabaseConfig

type DatabaseConfig struct {
	Sqlite   *SqliteConfig   `json:"sqlite,omitempty" yaml:"sqlite,omitempty"`
	Postgres *PostgresConfig `json:"postgres,omitempty" yaml:"postgres,omitempty"`
}

type LFSConfig

type LFSConfig struct {
	MaxBatchObjects              int   `json:"max_batch_objects" yaml:"max_batch_objects"`
	MaxBatchBodyBytes            int64 `json:"max_batch_body_bytes" yaml:"max_batch_body_bytes"`
	RequestLimitPerMinute        int   `json:"request_limit_per_minute" yaml:"request_limit_per_minute"`
	BandwidthLimitBytesPerMinute int64 `json:"bandwidth_limit_bytes_per_minute" yaml:"bandwidth_limit_bytes_per_minute"`
}

type PostgresConfig

type PostgresConfig struct {
	Host     string `json:"host" yaml:"host"`
	Port     int    `json:"port" yaml:"port"`
	User     string `json:"user" yaml:"user"`
	Password string `json:"password" yaml:"password"`
	Database string `json:"database" yaml:"database"`
	SSLMode  string `json:"sslmode" yaml:"sslmode"`
}

type S3Config

type S3Config struct {
	Bucket    string `json:"bucket" yaml:"bucket"`
	Provider  string `json:"provider,omitempty" yaml:"provider,omitempty"`
	Region    string `json:"region" yaml:"region"`
	AccessKey string `json:"access_key" yaml:"access_key"`
	SecretKey string `json:"secret_key" yaml:"secret_key"`
	Endpoint  string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
}

type SigningConfig

type SigningConfig struct {
	DefaultExpirySeconds int `json:"default_expiry_seconds" yaml:"default_expiry_seconds"`
}

type SqliteConfig

type SqliteConfig struct {
	File string `json:"file" yaml:"file"`
}

Jump to

Keyboard shortcuts

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