Documentation
¶
Overview ¶
Package config build on top of https://github.com/anyproto/any-sync-tools/tree/72b131eaf4d6dc299ecf87dad60648e68054b35a/anyconf.
Index ¶
Constants ¶
const ( // MinSupportedBundleFormat is the oldest config format version this binary can load. MinSupportedBundleFormat = 1 // CurrentBundleFormat is the config format version this binary creates. CurrentBundleFormat = 1 )
Variables ¶
var ( ErrS3BucketRequired = errors.New("S3 bucket name is required (--initial-s3-bucket)") ErrS3EndpointRequired = errors.New("S3 endpoint URL is required (--initial-s3-endpoint)") )
S3 configuration errors.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
BundleVersion string `yaml:"bundleVersion"`
BundleFormat int `yaml:"bundleFormat"`
ExternalAddr []string `yaml:"externalAddr"`
ConfigID string `yaml:"configId"`
NetworkID string `yaml:"networkId"`
StoragePath string `yaml:"storagePath"`
Account accountservice.Config `yaml:"account"`
Network NetworkConfig `yaml:"network"`
Coordinator CoordinatorConfig `yaml:"coordinator"`
Consensus ConsensusConfig `yaml:"consensus"`
FileNode FileNodeConfig `yaml:"filenode"`
}
func CreateWrite ¶
func CreateWrite(cfg *CreateOptions) *Config
func (*Config) NodeConfigs ¶
func (bc *Config) NodeConfigs() *NodeConfigs
NodeConfigs generates configurations for all node types based on the base config.
func (*Config) YamlClientConfig ¶
type ConsensusConfig ¶
type CoordinatorConfig ¶
type CreateOptions ¶
type CreateOptions struct {
CfgPath string
StorePath string
MongoURI string
RedisURI string
ExternalAddrs []string
// S3 storage (optional - if not set, BadgerDB is used)
// Credentials via env vars: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
S3Bucket string
S3Endpoint string
S3Region string // Optional, defaults to "us-east-1" if empty
S3ForcePathStyle bool
// Filenode storage limit per space in bytes.
// If 0, defaults to 1 TiB when writing config file.
FilenodeDefaultLimit uint64
}
type FileNodeConfig ¶
type FileNodeConfig struct {
RedisConnect string `yaml:"redisConnect"`
S3 *S3Config `yaml:"s3,omitempty"` // Optional: if present, use S3 storage instead of BadgerDB
// DefaultLimit is the storage limit per space in bytes.
// If not set (0), defaults to 1 TiB for backwards compatibility with old configs.
//
// TODO(bundleFormat:v2): Remove omitempty and runtime default. New configs already
// write 1 TiB explicitly; v2 can require the field to be present in config file.
DefaultLimit uint64 `yaml:"defaultLimit,omitempty"`
}
type NetworkConfig ¶
type NodeConfigs ¶
type NodeConfigs struct {
Coordinator *coordinatorconfig.Config
Consensus *consensusconfig.Config
Filenode *filenodeconfig.Config
Sync *syncconfig.Config
// Used for our component and we can't add this into existing configs.
FilenodeStorePath string
}
NodeConfigs holds configuration for all node types in the system.
type S3Config ¶
type S3Config struct {
Bucket string `yaml:"bucket"` // S3 bucket name (required)
Endpoint string `yaml:"endpoint"` // S3 endpoint URL (required, e.g., "https://s3.us-east-1.amazonaws.com")
Region string `yaml:"region,omitempty"` // S3 region for SigV4 signing (default: "us-east-1")
ForcePathStyle bool `yaml:"forcePathStyle,omitempty"` // Use path-style URLs (required for MinIO)
}
S3Config configures S3-compatible storage backend for the filenode. Supports AWS S3, MinIO, Cloudflare R2, Backblaze B2, etc. Credentials are provided via environment variables: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
TODO(bundleFormat:v2): Make Region a required field instead of defaulting to "us-east-1". This will force explicit configuration and avoid silent auth failures with non-default regions.