config

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir returns the OS-standard data directory for ATB. If ATB_DATA_DIR (or its compact alias ATB_DATADIR) is set, it takes precedence on every platform — useful for shared installations where each user (or a system-wide profile) wants to point at a common data volume without editing per-user config files. On Windows: %LOCALAPPDATA%\atb\data On macOS: ~/Library/Application Support/atb/data On Linux/other: $XDG_DATA_HOME/atb/data or ~/.local/share/atb/data

func DefaultPath

func DefaultPath() string

DefaultPath returns the default config file path. If ATB_CONFIG is set, it takes precedence — letting a shared-server admin point all users at a single config file via /etc/profile.d. On Windows: %LOCALAPPDATA%\atb\config.toml On macOS: ~/Library/Application Support/atb/config.toml On Linux/other: $XDG_CONFIG_HOME/atb/config.toml or ~/.config/atb/config.toml

func ExpandPath

func ExpandPath(path string) (string, error)

ExpandPath expands a leading ~ to the user's home directory.

func ResolveDataDir added in v0.16.0

func ResolveDataDir(cfg Config, flagValue string) string

ResolveDataDir returns the effective data directory using this precedence:

  1. flagValue (--data-dir CLI flag) if non-empty
  2. ATB_DATA_DIR environment variable (alias: ATB_DATADIR)
  3. cfg.General.DataDir from the loaded config

Use this everywhere a command needs the data directory so the env var works in shared-server setups without forcing each user to maintain their own config file.

func Save

func Save(cfg Config, path string) error

Save writes cfg to path as TOML, creating parent directories as needed.

Types

type AGCConfig added in v0.18.0

type AGCConfig struct {
	ArchiveMapURL  string `toml:"archive_map_url"`
	ArchiveBaseURL string `toml:"archive_base_url"`
	ArchiveDir     string `toml:"archive_dir"`
}

AGCConfig holds overrides for AGC genome-archive retrieval. An empty ArchiveMapURL or ArchiveDir falls back to the default in internal/sources; an empty ArchiveBaseURL means downloads resolve through the published index rather than a synthesized base URL.

type Config

type Config struct {
	General  GeneralConfig  `toml:"general"`
	Fetch    FetchConfig    `toml:"fetch"`
	Download DownloadConfig `toml:"download"`
	AGC      AGCConfig      `toml:"agc"`
}

Config holds all configuration for atb.

func Default

func Default() Config

Default returns a Config populated with sensible defaults.

func Load

func Load(path string) (Config, error)

Load reads a TOML config from path. If the file does not exist, it returns the default config without error.

type DownloadConfig

type DownloadConfig struct {
	Parallel       int    `toml:"parallel"`
	OutputDir      string `toml:"output_dir"`
	CheckDiskSpace bool   `toml:"check_disk_space"`
	MinFreeSpaceGB int    `toml:"min_free_space_gb"`
}

DownloadConfig holds settings for genome downloads.

type FetchConfig

type FetchConfig struct {
	BaseURL  string `toml:"base_url"`
	Parallel int    `toml:"parallel"`
}

FetchConfig holds settings for metadata fetching.

type GeneralConfig

type GeneralConfig struct {
	DataDir       string `toml:"data_dir"`
	DefaultFormat string `toml:"default_format"`
}

GeneralConfig holds general application settings.

Jump to

Keyboard shortcuts

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