config

package
v0.37.4 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const IngitDBDirName = ".ingitdb"

IngitDBDirName is the directory that holds all inGitDB configuration files.

View Source
const NamespaceImportSuffix = ".*"

NamespaceImportSuffix is the suffix used to identify namespace import keys.

View Source
const RootCollectionsFileName = "root-collections.yaml"

RootCollectionsFileName is the file that maps collection IDs to local paths. It is a flat YAML map with no wrapper key.

View Source
const SettingsFileName = "settings.yaml"

SettingsFileName is the file that holds per-database settings.

View Source
const SubscribersConfigFileName = ".ingitdb/subscribers.yaml"

Variables

This section is empty.

Functions

func IsNamespaceImport added in v0.25.0

func IsNamespaceImport(key string) bool

IsNamespaceImport returns true if the key ends with ".*" suffix, indicating it is a namespace import that references another directory's .ingitdb.yaml file.

func ReadRootCollectionsFromFile added in v0.28.1

func ReadRootCollectionsFromFile(dirPath string, o ingitdb.ReadOptions) (map[string]string, error)

ReadRootCollectionsFromFile reads .ingitdb/root-collections.yaml from dirPath. If the file does not exist, returns nil map with no error.

Types

type Language

type Language struct {
	Required string `yaml:"required,omitempty"`
	Optional string `yaml:"optional,omitempty"`
}

Language defines a supported language for this database.

type RootConfig

type RootConfig struct {
	Settings
	RootCollections map[string]string // loaded from root-collections.yaml; no yaml tag (loaded separately)
}

RootConfig holds the full configuration for an inGitDB database. Settings is loaded from .ingitdb/settings.yaml. RootCollections is loaded from .ingitdb/root-collections.yaml (flat YAML map).

func ReadRootConfigFromFile

func ReadRootConfigFromFile(dirPath string, o ingitdb.ReadOptions) (RootConfig, error)

ReadRootConfigFromFile reads both .ingitdb/settings.yaml and .ingitdb/root-collections.yaml from dirPath, merges them into a RootConfig, optionally validates, and resolves namespace imports. Missing files are not errors; zero-values are used instead.

func (*RootConfig) ResolveNamespaceImports added in v0.25.0

func (rc *RootConfig) ResolveNamespaceImports(baseDirPath string) error

ResolveNamespaceImports resolves all namespace import keys (ending with ".*") in rootCollections. For each such key, it reads the .ingitdb/root-collections.yaml file from the referenced directory and imports all its entries with the namespace prefix prepended.

baseDirPath is the directory containing the current .ingitdb/ directory.

Returns an error if:

  • The referenced directory does not exist
  • The referenced directory has no .ingitdb/root-collections.yaml file
  • The referenced root-collections.yaml has no entries

func (*RootConfig) Validate

func (rc *RootConfig) Validate() error

type Settings added in v0.28.1

type Settings struct {
	// DefaultNamespace is used as the collection ID prefix when this DB is
	// opened directly (not imported via a namespace import). For example,
	// if DefaultNamespace is "todo" and the DB has collection "tasks",
	// it becomes "todo.tasks" when opened directly.
	DefaultNamespace string     `yaml:"default_namespace,omitempty"`
	Languages        []Language `yaml:"languages,omitempty"`
}

Settings holds per-database settings stored in .ingitdb/settings.yaml.

func ReadSettingsFromFile added in v0.28.1

func ReadSettingsFromFile(dirPath string, o ingitdb.ReadOptions) (Settings, error)

ReadSettingsFromFile reads .ingitdb/settings.yaml from dirPath. If the file does not exist, returns zero Settings with no error.

type SubscribersConfig added in v0.24.3

type SubscribersConfig struct {
	Subscribers map[string]*ingitdb.SubscriberDef `yaml:"subscribers,omitempty"`
}

func (*SubscribersConfig) Validate added in v0.24.3

func (sc *SubscribersConfig) Validate() error

Jump to

Keyboard shortcuts

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