Add Phase 1 foundation: Go module, core types, DB infrastructure, config
Establish the project foundation with three packages: - core: shared types (Header, Metadata, Value, ObjectType, UUID generation) - db: SQLite migration framework, connection management (WAL, FK, busy timeout), transaction helpers (StartTX/EndTX), time conversion - config: runtime configuration (DB path, blob store, Minio, gRPC addr) Includes initial schema migration (001_initial.sql) with 13 tables covering shared infrastructure, bibliographic data, and artifact repository. Full test coverage for all packages, strict linting (.golangci.yaml), and Makefile. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
51
config/config.go
Normal file
51
config/config.go
Normal file
@@ -0,0 +1,51 @@
|
||||
// Package config provides path and endpoint configuration for the exo system.
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// Config holds all runtime configuration for exo.
|
||||
type Config struct {
|
||||
// BasePath is the root directory for all exo data.
|
||||
BasePath string
|
||||
|
||||
// DatabasePath is the path to the unified SQLite database.
|
||||
DatabasePath string
|
||||
|
||||
// BlobStorePath is the root of the content-addressable blob store.
|
||||
BlobStorePath string
|
||||
|
||||
// MinioEndpoint is the S3-compatible endpoint for remote blob backup.
|
||||
MinioEndpoint string
|
||||
|
||||
// MinioBucket is the bucket name for blob backup.
|
||||
MinioBucket string
|
||||
|
||||
// GRPCListenAddr is the address exod listens on for gRPC connections.
|
||||
GRPCListenAddr string
|
||||
}
|
||||
|
||||
// DefaultBasePath returns $HOME/exo.
|
||||
func DefaultBasePath() string {
|
||||
return filepath.Join(os.Getenv("HOME"), "exo")
|
||||
}
|
||||
|
||||
// Default returns a Config with sensible defaults rooted at $HOME/exo.
|
||||
func Default() Config {
|
||||
base := DefaultBasePath()
|
||||
return FromBasePath(base)
|
||||
}
|
||||
|
||||
// FromBasePath returns a Config rooted at the given base path.
|
||||
func FromBasePath(base string) Config {
|
||||
return Config{
|
||||
BasePath: base,
|
||||
DatabasePath: filepath.Join(base, "exo.db"),
|
||||
BlobStorePath: filepath.Join(base, "blobs"),
|
||||
MinioEndpoint: "",
|
||||
MinioBucket: "exo-blobs",
|
||||
GRPCListenAddr: "localhost:9090",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user