Documentation
¶
Index ¶
- Constants
- func AdminInitialPasswordFilePath(appDir string) string
- func DefaultFilecoinRPCURL(network string) (string, bool)
- func DefaultFilecoinRPCURLs() map[string]string
- func EnvFieldForName(envName string) (string, bool)
- func EnvManagedFieldPaths() map[string]string
- func FieldMetadataByPath() map[string]FieldMetadata
- func LoadFileForSettings(path string) (*Config, PersistedFieldPresence, error)
- func ReadAdminInitialPasswordFile(appDir string) (string, bool, error)
- func Save(path string, cfg *Config) error
- func SaveForSettings(path string, cfg *Config, presence PersistedFieldPresence) error
- func WriteAdminInitialPasswordFile(appDir, password string) (string, error)
- type AdminAuthBootstrap
- type AdminAuthConfig
- type AdminConfig
- type CacheConfig
- type Config
- type DatabaseConfig
- type FieldError
- type FieldMetadata
- type FilecoinConfig
- type FilecoinObservabilityConfig
- type InitOptions
- type InitResult
- type LoggingConfig
- type LoggingS3AccessConfig
- type PersistedFieldPresence
- type S3Config
- type ServerConfig
- type Source
- type TLSConfig
- type WorkerConfig
- type WorkerPoolConfig
Constants ¶
const ( DefaultFilecoinCopies = 3 MaxFilecoinDefaultCopies = model.StorageCopiesMax )
Variables ¶
This section is empty.
Functions ¶
func AdminInitialPasswordFilePath ¶
AdminInitialPasswordFilePath returns the generated Admin password file path.
func DefaultFilecoinRPCURL ¶
DefaultFilecoinRPCURL returns the built-in RPC URL for a Filecoin network.
func DefaultFilecoinRPCURLs ¶
DefaultFilecoinRPCURLs returns a copy of the built-in Filecoin RPC URL map.
func EnvFieldForName ¶
EnvFieldForName returns the config field path for a supported SYNAPS3_ env var.
func EnvManagedFieldPaths ¶
EnvManagedFieldPaths returns recognized config fields currently controlled by env vars.
func FieldMetadataByPath ¶
func FieldMetadataByPath() map[string]FieldMetadata
FieldMetadataByPath returns metadata keyed by dotted config field path.
func LoadFileForSettings ¶
func LoadFileForSettings(path string) (*Config, PersistedFieldPresence, error)
LoadFileForSettings reads TOML for settings persistence without environment overlays. Runtime defaults are applied for validation and UI display, while field presence lets settings writes preserve omitted TOML fields.
func ReadAdminInitialPasswordFile ¶
ReadAdminInitialPasswordFile reads a generated Admin password if the file exists.
func Save ¶
Save writes a generated TOML config file. Existing custom comments and formatting are not preserved.
func SaveForSettings ¶
func SaveForSettings(path string, cfg *Config, presence PersistedFieldPresence) error
SaveForSettings writes settings TOML while preserving absent manual/read-only fields.
Types ¶
type AdminAuthBootstrap ¶
AdminAuthBootstrap contains generated local admin credentials and session secret.
func NewAdminAuthBootstrap ¶
func NewAdminAuthBootstrap() (AdminAuthBootstrap, error)
NewAdminAuthBootstrap generates a password, bcrypt hash, and session secret.
type AdminAuthConfig ¶
type AdminConfig ¶
type AdminConfig struct {
Addr string `koanf:"addr"`
TrustedProxies []string `koanf:"trusted_proxies"`
Auth AdminAuthConfig `koanf:"auth"`
}
type CacheConfig ¶
type Config ¶
type Config struct {
Server ServerConfig `koanf:"server"`
S3 S3Config `koanf:"s3"`
Filecoin FilecoinConfig `koanf:"filecoin"`
Database DatabaseConfig `koanf:"database"`
Cache CacheConfig `koanf:"cache"`
Worker WorkerConfig `koanf:"worker"`
Logging LoggingConfig `koanf:"logging"`
Admin AdminConfig `koanf:"admin"`
}
func DefaultConfig ¶
func Load ¶
Load reads configuration from a TOML file (if it exists) and overlays environment variables prefixed with SYNAPS3_.
func LoadSource ¶
LoadSource reads configuration from a resolved source.
func (*Config) FieldValidationErrors ¶
func (c *Config) FieldValidationErrors() []FieldError
FieldValidationErrors returns validation errors tied to dotted config paths.
type DatabaseConfig ¶
type FieldError ¶
FieldError is a validation error tied to a dotted config field path.
func (FieldError) Error ¶
func (e FieldError) Error() string
type FieldMetadata ¶
type FieldMetadata struct {
Label string `json:"label"`
Description string `json:"description"`
Env string `json:"env,omitempty"`
Editable bool `json:"editable"`
Secret bool `json:"secret"`
}
FieldMetadata describes a config field for admin settings clients.
type FilecoinConfig ¶
type FilecoinConfig struct {
Network string `koanf:"network"` // calibration | mainnet
RPCURL string `koanf:"rpc_url"`
PrivateKey string `koanf:"private_key"`
Source string `koanf:"source"`
WithCDN bool `koanf:"with_cdn"`
AllowPrivateNetworks bool `koanf:"allow_private_networks"`
DefaultCopies int `koanf:"default_copies"`
Observability FilecoinObservabilityConfig `koanf:"observability"`
}
type InitOptions ¶
type InitOptions struct {
Dir string
}
InitOptions controls app data directory initialization.
type InitResult ¶
type InitResult struct {
Dir string
ConfigPath string
DatabaseDir string
CacheDir string
DefaultDir bool
AdminInitialPassword string
}
InitResult describes the paths created by app data directory initialization.
func InitAppDataDir ¶
func InitAppDataDir(opts InitOptions) (InitResult, error)
InitAppDataDir creates a reference config file and runtime directories.
type LoggingConfig ¶
type LoggingConfig struct {
Level string `koanf:"level"` // debug | info | warn | error
Format string `koanf:"format"` // json | text
S3Access LoggingS3AccessConfig `koanf:"s3_access"`
}
type LoggingS3AccessConfig ¶
type PersistedFieldPresence ¶
type PersistedFieldPresence struct {
FilecoinPrivateKey bool
DatabaseDriver bool
DatabaseDSN bool
DatabaseMaxOpen bool
DatabaseMaxIdle bool
CacheDir bool
AdminAddr bool
AdminTrustedProxies bool
AdminAuthEnabled bool
AdminAuthUsername bool
AdminAuthPasswordHash bool
AdminAuthSessionSecret bool
AdminAuthSessionTTL bool
}
PersistedFieldPresence records manual/read-only fields that were explicitly present in an existing TOML file. Settings writes use it to avoid materializing defaults for fields the browser cannot edit.
type ServerConfig ¶
type WorkerConfig ¶
type WorkerConfig struct {
Upload WorkerPoolConfig `koanf:"upload"`
Evictor WorkerPoolConfig `koanf:"evictor"`
StorageCleanup WorkerPoolConfig `koanf:"storage_cleanup"`
}