workspace_config_blobs

package
v0.0.0-...-8bab08b Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Coder = hyphence.CoderToTypedBlob[Config]{
	Metadata: hyphence.TypedMetadataCoder[Config]{},
	Blob: hyphence.CoderTypeMapWithoutType[Config](
		map[string]interfaces.CoderBufferedReadWriter[*Config]{
			ids.TypeTomlWorkspaceConfigV0: hyphence.CoderTommy[
				Config,
				*Config,
			]{
				Decode: func(b []byte) (Config, error) {
					doc, err := DecodeV0(b)
					if err != nil {
						return nil, err
					}
					return doc.Data(), nil
				},
				Encode: func(cfg Config) ([]byte, error) {
					doc, err := DecodeV0(nil)
					if err != nil {
						return nil, err
					}
					switch v := cfg.(type) {
					case *V0:
						*doc.Data() = *v
					case V0:
						*doc.Data() = v
					}
					return doc.Encode()
				},
			},
			ids.TypeTomlWorkspaceConfigV1: hyphence.CoderTommy[
				Config,
				*Config,
			]{
				Decode: func(b []byte) (Config, error) {
					doc, err := DecodeV1(b)
					if err != nil {
						return nil, err
					}
					return doc.Data(), nil
				},
				Encode: func(cfg Config) ([]byte, error) {
					doc, err := DecodeV1(nil)
					if err != nil {
						return nil, err
					}
					switch v := cfg.(type) {
					case *V1:
						*doc.Data() = *v
					case V1:
						*doc.Data() = v
					}
					return doc.Encode()
				},
			},
			ids.TypeTomlWorkspaceConfigV2: hyphence.CoderTommy[
				Config,
				*Config,
			]{
				Decode: func(b []byte) (Config, error) {
					doc, err := DecodeV2(b)
					if err != nil {
						return nil, err
					}
					return doc.Data(), nil
				},
				Encode: func(cfg Config) ([]byte, error) {
					doc, err := DecodeV2(nil)
					if err != nil {
						return nil, err
					}
					switch v := cfg.(type) {
					case *V2:
						*doc.Data() = *v
					case V2:
						*doc.Data() = v
					}
					return doc.Encode()
				},
			},
		},
	),
}

Functions

func DecodeV0Into

func DecodeV0Into(data *V0, doc *document.Document, container *cst.Node, consumed map[string]bool, keyPrefix string) error

func DecodeV1Into

func DecodeV1Into(data *V1, doc *document.Document, container *cst.Node, consumed map[string]bool, keyPrefix string) error

func DecodeV2Into

func DecodeV2Into(data *V2, doc *document.Document, container *cst.Node, consumed map[string]bool, keyPrefix string) error

func EncodeV0From

func EncodeV0From(data *V0, doc *document.Document, container *cst.Node) error

func EncodeV1From

func EncodeV1From(data *V1, doc *document.Document, container *cst.Node) error

func EncodeV2From

func EncodeV2From(data *V2, doc *document.Document, container *cst.Node) error

Types

type CalDAVConfig

type CalDAVConfig struct {
	URL      string `toml:"url"`
	Username string `toml:"username"`
}

func (CalDAVConfig) Resolve

func (c CalDAVConfig) Resolve() (ResolvedCalDAVConfig, error)

Resolve merges TOML config values with environment variables. TOML values take precedence; env vars are the fallback. Env vars: CALDAV_URL, CALDAV_USERNAME, CALDAV_PASSWORD. Password is always from CALDAV_PASSWORD (never stored in config).

type CalendarConfig

type CalendarConfig struct {
	URL  string   `toml:"url"`
	Type string   `toml:"type"`
	Tags []string `toml:"tags,omitempty"`
}

CalendarConfig maps a CalDAV calendar to a dodder type and optional tags.

type Config

type Config interface {
	GetDefaults() repo_configs.Defaults
}

type ConfigTemporary

type ConfigTemporary interface {
	Config
	// contains filtered or unexported methods
}

type ConfigWithDefaultQueryString

type ConfigWithDefaultQueryString interface {
	Config
	GetDefaultQueryString() string
}

type ConfigWithDryRun

type ConfigWithDryRun interface {
	Config
	domain_interfaces.ConfigDryRunGetter
}

type ConfigWithHaustoria

type ConfigWithHaustoria interface {
	Config
	GetHaustoriaConfig() HaustoriaConfig
}

type ConfigWithParentPath

type ConfigWithParentPath interface {
	Config
	GetParentPath() string
}

type ConfigWithRepo

type ConfigWithRepo interface {
	GetRepoConfig() repo_configs.ConfigOverlay
}

type ConfigWithSyncBaseline

type ConfigWithSyncBaseline interface {
	Config
	GetSyncTai() string
	GetSyncDigest() string
}

type FolderConfig

type FolderConfig struct {
	Path string   `toml:"path"`
	Type string   `toml:"type"`
	Tags []string `toml:"tags,omitempty"`
}

FolderConfig maps a remote folder to a dodder type and optional tags.

type HaustoriaConfig

type HaustoriaConfig struct {
	Type      string                    `toml:"type"`
	CalDAV    *CalDAVConfig             `toml:"caldav,omitempty"`
	Calendars map[string]CalendarConfig `toml:"calendars,omitempty"`
	Orgmode   *OrgmodeConfig            `toml:"orgmode,omitempty"`
	Folders   map[string]FolderConfig   `toml:"folders,omitempty"`
}

type OrgmodeConfig

type OrgmodeConfig struct {
	Transport string         `toml:"transport"` // "webdav" or "sftp"
	WebDAV    *OrgmodeWebDAV `toml:"webdav,omitempty"`
	SFTP      *OrgmodeSFTP   `toml:"sftp,omitempty"`
}

OrgmodeConfig holds orgmode haustoria connection parameters. Supports WebDAV or SFTP as the file transport.

func (OrgmodeConfig) ResolveOrgmode

func (orgmodeConfig OrgmodeConfig) ResolveOrgmode() (ResolvedOrgmodeConfig, error)

ResolveOrgmode merges TOML config values with environment variables for orgmode haustoria. Env vars: ORGMODE_WEBDAV_URL, ORGMODE_WEBDAV_USERNAME, ORGMODE_WEBDAV_PASSWORD, ORGMODE_SFTP_HOST, ORGMODE_SFTP_USER, ORGMODE_SFTP_PASSWORD.

type OrgmodeSFTP

type OrgmodeSFTP struct {
	Host           string `toml:"host"`
	Port           int    `toml:"port"`
	User           string `toml:"user"`
	PrivateKeyPath string `toml:"private-key-path"`
	KnownHostsFile string `toml:"known-hosts-file"`
}

OrgmodeSFTP holds SFTP connection parameters for orgmode sync.

type OrgmodeWebDAV

type OrgmodeWebDAV struct {
	URL      string `toml:"url"`
	Username string `toml:"username"`
}

OrgmodeWebDAV holds WebDAV connection parameters for orgmode sync.

type ResolvedCalDAVConfig

type ResolvedCalDAVConfig struct {
	URL      string
	Username string
	Password string
}

type ResolvedOrgmodeConfig

type ResolvedOrgmodeConfig struct {
	Transport          string
	WebDAVURL          string
	WebDAVUsername     string
	WebDAVPassword     string
	SFTPHost           string
	SFTPPort           int
	SFTPUser           string
	SFTPPassword       string
	SFTPPrivateKeyPath string
	SFTPKnownHostsFile string
}

ResolvedOrgmodeConfig holds fully resolved orgmode connection parameters.

type Temporary

type Temporary struct {
	Defaults repo_configs.DefaultsV1OmitEmpty `toml:"defaults,omitempty"`
}

func (Temporary) GetDefaults

func (blob Temporary) GetDefaults() repo_configs.Defaults

type TypedConfig

type TypedConfig = hyphence.TypedBlob[Config]

type V0

type V0 struct {
	Defaults repo_configs.DefaultsV1OmitEmpty `toml:"defaults,omitempty"`

	Query string `toml:"query,omitempty"`

	DryRun bool `toml:"dry-run"`
}

func (V0) GetDefaultQueryString

func (blob V0) GetDefaultQueryString() string

func (V0) GetDefaults

func (blob V0) GetDefaults() repo_configs.Defaults

func (V0) IsDryRun

func (blob V0) IsDryRun() bool

type V0Document

type V0Document struct {
	// contains filtered or unexported fields
}

func DecodeV0

func DecodeV0(input []byte) (*V0Document, error)

func (*V0Document) Comment

func (d *V0Document) Comment(key string) string

func (*V0Document) Data

func (d *V0Document) Data() *V0

func (*V0Document) Encode

func (d *V0Document) Encode() ([]byte, error)

func (*V0Document) InlineComment

func (d *V0Document) InlineComment(key string) string

func (*V0Document) SetComment

func (d *V0Document) SetComment(key, comment string)

func (*V0Document) SetInlineComment

func (d *V0Document) SetInlineComment(key, comment string)

func (*V0Document) Undecoded

func (d *V0Document) Undecoded() []string

type V1

type V1 struct {
	V0
	ParentPath string `toml:"parent-path,omitempty"`
	SyncTai    string `toml:"sync-tai,omitempty"`
	SyncDigest string `toml:"sync-digest,omitempty"`
}

func (V1) GetParentPath

func (blob V1) GetParentPath() string

func (V1) GetSyncDigest

func (blob V1) GetSyncDigest() string

func (V1) GetSyncTai

func (blob V1) GetSyncTai() string

type V1Document

type V1Document struct {
	// contains filtered or unexported fields
}

func DecodeV1

func DecodeV1(input []byte) (*V1Document, error)

func (*V1Document) Comment

func (d *V1Document) Comment(key string) string

func (*V1Document) Data

func (d *V1Document) Data() *V1

func (*V1Document) Encode

func (d *V1Document) Encode() ([]byte, error)

func (*V1Document) InlineComment

func (d *V1Document) InlineComment(key string) string

func (*V1Document) SetComment

func (d *V1Document) SetComment(key, comment string)

func (*V1Document) SetInlineComment

func (d *V1Document) SetInlineComment(key, comment string)

func (*V1Document) Undecoded

func (d *V1Document) Undecoded() []string

type V2

type V2 struct {
	V1
	Haustoria HaustoriaConfig `toml:"haustoria,omitempty"`
}

func (V2) GetHaustoriaConfig

func (blob V2) GetHaustoriaConfig() HaustoriaConfig

type V2Document

type V2Document struct {
	// contains filtered or unexported fields
}

func DecodeV2

func DecodeV2(input []byte) (*V2Document, error)

func (*V2Document) Comment

func (d *V2Document) Comment(key string) string

func (*V2Document) Data

func (d *V2Document) Data() *V2

func (*V2Document) Encode

func (d *V2Document) Encode() ([]byte, error)

func (*V2Document) InlineComment

func (d *V2Document) InlineComment(key string) string

func (*V2Document) SetComment

func (d *V2Document) SetComment(key, comment string)

func (*V2Document) SetInlineComment

func (d *V2Document) SetInlineComment(key, comment string)

func (*V2Document) Undecoded

func (d *V2Document) Undecoded() []string

Source Files

  • io.go
  • main.go
  • temporary.go
  • v0.go
  • v0_tommy.go
  • v1.go
  • v1_tommy.go
  • v2.go
  • v2_tommy.go

Jump to

Keyboard shortcuts

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