Documentation
¶
Index ¶
- Constants
- Variables
- func ArgsForCompress(name string) string
- func AutoDetectCompression(supportsZstd bool, isSingularity bool)
- func BaseImageSifName() string
- func CompressNames() []string
- func DeleteConfigKey(path, key string) error
- func DetectApptainerBin() string
- func DetectSchedulerBin() string
- func DirExists(path string) bool
- func FilterDirsByLayer(dirs []string, layer DataLayer) []string
- func FindBaseImage() string
- func FindHelperScript(name string) (string, error)
- func FindImage(name string) (string, error)
- func GetAvailableDistros() []string
- func GetBaseImage() string
- func GetBaseImageWritePath() (string, error)
- func GetBuildScriptSearchPaths() []string
- func GetCacheSearchPaths() []string
- func GetChannels() []string
- func GetConfigPathByLayer(layer string) (string, error)
- func GetExtraBuildDirs() []string
- func GetExtraHelperDirs() []string
- func GetExtraImageDirs() []string
- func GetExtraRootConfigPath() string
- func GetExtraRootDir() string
- func GetExtraScriptsLinks() []string
- func GetFileBookmarksPath() string
- func GetHelperBookmarksPath() string
- func GetHelperHistoryPath() string
- func GetHelperScriptSearchPaths() []string
- func GetHelperStateDir(id string) string
- func GetImageSearchPaths() []string
- func GetLoadedConfigPaths() []string
- func GetRootConfigPath() string
- func GetRootDir() string
- func GetRunningServerPort() int
- func GetSchedulerTypeFromBin(binPath string) string
- func GetScratchDataDir() string
- func GetServerLogPath() string
- func GetServerLogPathForHost(host string) string
- func GetServerPidFilePath() string
- func GetServerSavedPortPath() string
- func GetSystemConfigPath() string
- func GetUserCacheDir() string
- func GetUserConfigDir() string
- func GetUserConfigPath() (string, error)
- func GetUserDataDir() string
- func GetUserStateDir() string
- func GetWritableCacheDir() (string, error)
- func GetWritableHelperScriptsDir() (string, error)
- func GetWritableImagesDir() (string, error)
- func GetWritableTmpDir() string
- func InitDataPaths()
- func InitViper() error
- func IsInsideContainer() bool
- func IsValidBlockSize(size string) bool
- func IsValidDistro(distro string) bool
- func ListServerPidFiles() []string
- func LoadDefaults(executablePath string)
- func LoadFromViper()
- func NormalizeCompressArgs(val string) string
- func NormalizeConfigLayer(layer string) string
- func ParseDirEntry(entry string) (string, bool)
- func ReadConfigAllKeys(path string) []string
- func ReadConfigKey(configPath, key string) string
- func ReadConfigSliceKey(configPath, key string) []string
- func ReadSavedServerPort() int
- func ResolveReadableConfigPath(layer string) (path, layerType string, err error)
- func ResolveWritableConfigPath(layer string) (path, layerType string, err error)
- func ResolveWritableConfigPathVerbose(layer string) (path, layerType, fellBackFrom string, err error)
- func SaveMinimalConfigTo(path, apptainerBin, schedulerBin, compressArgs string, ...) error
- func SaveServerPort(port int) error
- func SetConfigKey(path, key, value string) error
- func UpdateConfigKey(path, key string, value any) error
- func ValidateBinary(binPath string) bool
- type BuildConfig
- type CompressOption
- type Config
- type ConfigLayerInfo
- type ConfigSearchPath
- type DataLayer
- type DataPaths
- type SearchDir
- type ServerState
Constants ¶
const ConfigFilename = "config"
ConfigFilename is the name of the config file
const ConfigType = "yaml"
ConfigType is the type of config file (yaml, json, toml)
const DEFAULT_DISTRO = "ubuntu24"
const DefaultScriptsLink = "https://raw.githubusercontent.com/Justype/cnt-scripts/main"
DefaultScriptsLink is the base URL for remote build scripts and helpers
const ExitCodeJobsSubmitted = 3
ExitCodeJobsSubmitted is returned by condatainer commands when build jobs are submitted to the scheduler rather than run immediately. Callers (e.g. helper overlay checks) can detect this exit code to show a more helpful message.
const GITHUB_REPO = GitHubRepo // Exported constant for compatibility
const GitHubRepo = "Justype/condatainer"
const VERSION = "1.4.1"
Variables ¶
var BlockSizeCompletions = []string{"64k", "128k", "256k", "512k", "1m"}
BlockSizeCompletions lists common mksquashfs block sizes for shell completion
var CompressOptions = []CompressOption{
{"gzip", "-comp gzip", "Use gzip compression"},
{"lz4", "-comp lz4", "Use lz4 compression"},
{"zstd", "-comp zstd -Xcompression-level 14", "Use zstd compression level 14"},
{"zstd-fast", "-comp zstd -Xcompression-level 3", "Use zstd compression level 3"},
{"zstd-medium", "-comp zstd -Xcompression-level 8", "Use zstd compression level 8"},
{"zstd-high", "-comp zstd -Xcompression-level 19", "Use zstd compression level 19"},
}
CompressOptions lists all supported compression shorthand names.
Functions ¶
func ArgsForCompress ¶ added in v1.2.0
ArgsForCompress returns the full mksquashfs arguments corresponding to a recognised shortcut name. Return itself if no match found.
func AutoDetectCompression ¶
AutoDetectCompression sets compression based on the runtime binary and its version. This should be called after apptainer version is known. supportsZstd: whether the current apptainer version supports zstd (>= 1.4) isSingularity: whether the binary is Singularity (uses gzip by default)
func BaseImageSifName ¶ added in v1.2.0
func BaseImageSifName() string
BaseImageSifName returns the expected .sif filename for the configured DefaultDistro. e.g. "ubuntu24" → "ubuntu24--base_image.sif"
func CompressNames ¶ added in v1.2.0
func CompressNames() []string
CompressNames returns a list of the shortcut names (used for completion)
func DeleteConfigKey ¶ added in v1.4.0
DeleteConfigKey removes a key from the config file at path. Nested keys (e.g. "build.compress_args") are handled by navigating the settings map. If removing a nested key leaves the parent empty, the parent is removed too.
func DetectApptainerBin ¶
func DetectApptainerBin() string
DetectApptainerBin attempts to find apptainer binary Returns the full absolute path if found, empty string otherwise
func DetectSchedulerBin ¶
func DetectSchedulerBin() string
DetectSchedulerBin attempts to find scheduler binary Returns the binary path if found, empty string otherwise
func FilterDirsByLayer ¶ added in v1.5.1
FilterDirsByLayer returns the subset of dirs belonging to layer, preserving order.
func FindBaseImage ¶
func FindBaseImage() string
FindBaseImage searches all image paths for the base image. Returns the full path if found, empty string otherwise.
func FindHelperScript ¶
FindHelperScript searches all helper script paths for a script by name. Returns the full path to the script if found.
func FindImage ¶
FindImage searches all image paths for an image by name. Returns the full path to the image if found.
func GetAvailableDistros ¶ added in v1.2.0
func GetAvailableDistros() []string
func GetBaseImage ¶
func GetBaseImage() string
GetBaseImage returns the path to base_image.sif, searching all image directories. Searches all directories and returns the first found, or falls back to first writable path.
func GetBaseImageWritePath ¶
GetBaseImageWritePath returns the path where a new base image should be written.
func GetBuildScriptSearchPaths ¶
func GetBuildScriptSearchPaths() []string
GetBuildScriptSearchPaths returns all paths to search for build scripts.
func GetCacheSearchPaths ¶ added in v1.4.0
func GetCacheSearchPaths() []string
GetCacheSearchPaths returns all personal cache directories to search. Cache is always the personal XDG cache dir to avoid cross-user pollution.
func GetChannels ¶ added in v1.3.0
func GetChannels() []string
GetChannels returns the conda channels from config or environment. CNT_CHANNELS supports "|" and ":" as separators ("|" takes precedence). Overwrite semantics: if set in config, highest-priority layer wins (no merge).
func GetConfigPathByLayer ¶ added in v1.5.1
GetConfigPathByLayer returns the config path for the specified config layer. Supported layers: "user"/"u", "app-root"/"root"/"r", "extra-root"/"e", "system"/"s"
func GetExtraBuildDirs ¶ added in v1.4.0
func GetExtraBuildDirs() []string
GetExtraBuildDirs returns explicit extra build-scripts directories from config or environment. CNT_EXTRA_BUILD_DIRS supports "|" and ":" as separators ("|" takes precedence).
func GetExtraHelperDirs ¶ added in v1.4.0
func GetExtraHelperDirs() []string
GetExtraHelperDirs returns explicit extra helper-scripts directories from config or environment. CNT_EXTRA_HELPER_DIRS uses "|" as separator; entries support ":ro"/":rw" markers.
func GetExtraImageDirs ¶ added in v1.4.0
func GetExtraImageDirs() []string
GetExtraImageDirs returns explicit extra image directories from config or environment. CNT_EXTRA_IMAGE_DIRS uses "|" as separator; entries support ":ro"/":rw" markers.
func GetExtraRootConfigPath ¶ added in v1.4.0
func GetExtraRootConfigPath() string
GetExtraRootConfigPath returns the extra-root config path ($CNT_EXTRA_ROOT/config.yaml). Returns empty string if CNT_EXTRA_ROOT is not set.
func GetExtraRootDir ¶ added in v1.4.0
func GetExtraRootDir() string
GetExtraRootDir returns the extra root directory from CNT_EXTRA_ROOT env var. Single value, env only (no config key). Used for group/lab shared installations. Returns empty string if not set. Cached via sync.Once.
func GetExtraScriptsLinks ¶ added in v1.3.0
func GetExtraScriptsLinks() []string
GetExtraScriptsLinks returns extra remote build script source URLs. CNT_EXTRA_SCRIPTS_LINKS uses "|" as separator (URLs contain "://").
func GetFileBookmarksPath ¶ added in v1.5.1
func GetFileBookmarksPath() string
GetFileBookmarksPath returns the path to the JSON file storing the dashboard's file-browser bookmarks. Path: ~/.local/state/condatainer/file-bookmarks.json
func GetHelperBookmarksPath ¶ added in v1.5.1
func GetHelperBookmarksPath() string
GetHelperBookmarksPath returns the path to the JSON file storing the dashboard's bookmarked (starred) helper names. Path: ~/.local/state/condatainer/helper-bookmarks.json
func GetHelperHistoryPath ¶ added in v1.5.0
func GetHelperHistoryPath() string
GetHelperHistoryPath returns the path to the JSONL helper run history file. Path: ~/.local/state/condatainer/helper-history.jsonl
func GetHelperScriptSearchPaths ¶
func GetHelperScriptSearchPaths() []string
GetHelperScriptSearchPaths returns all paths to search for helper scripts.
func GetHelperStateDir ¶ added in v1.5.0
GetHelperStateDir returns the per-ID helper state directory on NFS. Each helper run writes its ready/messages/done files under this path. Path: ~/.local/state/condatainer/helper/{id}/
func GetImageSearchPaths ¶
func GetImageSearchPaths() []string
GetImageSearchPaths returns all paths to search for images.
func GetLoadedConfigPaths ¶ added in v1.4.0
func GetLoadedConfigPaths() []string
GetLoadedConfigPaths returns the file paths of all config files actually loaded by InitViper, in priority order. These are the files that actively contribute to the effective configuration (via scalar precedence + array merging).
func GetRootConfigPath ¶ added in v1.4.0
func GetRootConfigPath() string
GetRootConfigPath returns the root config path (CNT_ROOT or standalone layout). Returns empty string if the root dir is not set.
func GetRootDir ¶ added in v1.4.0
func GetRootDir() string
GetRootDir returns the installation root directory. CNT_ROOT env var takes priority; otherwise auto-detected from the executable location.
Detection logic:
- CNT_ROOT env var — explicit root (set by sysadmin in module file)
- Executable in <dir>/bin/ and <dir> is not a standard user/system parent → use <dir>
Cached via sync.Once.
func GetRunningServerPort ¶ added in v1.5.0
func GetRunningServerPort() int
GetRunningServerPort returns the port of the currently running server on this host, reading it directly from the PID file. Returns 0 if the server is not running.
func GetSchedulerTypeFromBin ¶
GetSchedulerTypeFromBin derives the scheduler type from the binary path/name. The type is always inferred from the binary - it cannot be set independently.
func GetScratchDataDir ¶
func GetScratchDataDir() string
GetScratchDataDir returns the scratch data directory for HPC systems. Returns $SCRATCH/condatainer if SCRATCH is set.
func GetServerLogPath ¶ added in v1.5.0
func GetServerLogPath() string
GetServerLogPath returns the path to the server log file for the current host. Path: ~/.local/state/condatainer/server-{hostname}.log
func GetServerLogPathForHost ¶ added in v1.5.0
GetServerLogPathForHost returns the path to the server log file for the given host. Path: ~/.local/state/condatainer/server-{host}.log Since the state dir is on NFS, this works for any login node.
func GetServerPidFilePath ¶ added in v1.5.0
func GetServerPidFilePath() string
GetServerPidFilePath returns the path to the server PID/state file for the current host. Path: ~/.local/state/condatainer/server-{hostname}.pid Per-host files allow NFS home dirs shared across login nodes without conflicts.
func GetServerSavedPortPath ¶ added in v1.5.0
func GetServerSavedPortPath() string
GetServerSavedPortPath returns the path to the shared saved-port file. Path: ~/.local/state/condatainer/server.port Written by "server start --port" so the same port is reused on subsequent starts across all login nodes.
func GetSystemConfigPath ¶
func GetSystemConfigPath() string
GetSystemConfigPath returns the system-wide config path
func GetUserCacheDir ¶ added in v1.3.0
func GetUserCacheDir() string
GetUserCacheDir returns the user's cache directory following XDG spec. Returns $XDG_CACHE_HOME/condatainer or ~/.cache/condatainer
func GetUserConfigDir ¶ added in v1.5.0
func GetUserConfigDir() string
GetUserConfigDir returns the user's config directory following XDG spec. Returns $XDG_CONFIG_HOME/condatainer or ~/.config/condatainer
func GetUserConfigPath ¶
GetUserConfigPath returns the path to the user config file
func GetUserDataDir ¶
func GetUserDataDir() string
GetUserDataDir returns the user's data directory following XDG spec. Returns $XDG_DATA_HOME/condatainer or ~/.local/share/condatainer
func GetUserStateDir ¶ added in v1.1.1
func GetUserStateDir() string
GetUserStateDir returns the user's state directory following XDG spec. Returns $XDG_STATE_HOME/condatainer or ~/.local/state/condatainer
func GetWritableCacheDir ¶ added in v1.3.0
GetWritableCacheDir returns the writable personal cache directory ($XDG_CACHE_HOME/condatainer or ~/.cache/condatainer) — never a shared dir.
func GetWritableHelperScriptsDir ¶
GetWritableHelperScriptsDir returns the first writable helper scripts directory. Explicit extra_helper_dirs entries marked :ro are skipped. Shared dirs (extra_helper_dirs, CNT_EXTRA_ROOT, root) are probed only. Personal dirs (scratch, user) are created on first use.
func GetWritableImagesDir ¶
GetWritableImagesDir returns the first writable images directory. Explicit extra_image_dirs entries marked :ro are skipped. Shared dirs (extra_image_dirs, CNT_EXTRA_ROOT, root) are probed only. Personal dirs (scratch, user) are created on first use.
func GetWritableTmpDir ¶
func GetWritableTmpDir() string
GetWritableTmpDir returns the first writable tmp directory. Uses the same SearchDir + firstWritableDir logic as the other writable-dir resolvers: shared dirs (extra-root, root) create tmp only when the parent already exists; personal dirs (scratch, user) always create on first use.
func InitDataPaths ¶
func InitDataPaths()
InitDataPaths initializes GlobalDataPaths based on environment and config. This should be called after LoadDefaults and LoadFromViper.
func InitViper ¶
func InitViper() error
InitViper initializes Viper with proper search paths and defaults. Priority (highest to lowest): 1. Command-line flags (handled by cobra) 2. Environment variables (CNT_*) — always replaces for that key 3. User config file (~/.config/condatainer/config.yaml) 4. Extra root config ($CNT_EXTRA_ROOT/config.yaml, group/lab layer) 5. Root config ($CNT_ROOT/config.yaml or <install>/config.yaml) 6. System config file (/etc/condatainer/config.yaml) 7. Defaults
Scalar keys: highest-priority config file that sets the key wins. Array keys (extra_*_dirs, extra_scripts_links): merged across all config layers so that e.g. a sysadmin's extra_image_dirs in system config are visible to users who also have their own config. channels is an exception — overwrite, not merge.
func IsInsideContainer ¶
func IsInsideContainer() bool
IsInsideContainer checks if we're currently running inside a container
func IsValidBlockSize ¶ added in v1.3.0
IsValidBlockSize validates a mksquashfs -b value. Must be a power of two between 4096 and 1048576 (1M), with optional k/K or m/M suffix.
func IsValidDistro ¶ added in v1.2.0
IsValidDistro returns true if the provided name matches one of the known distro slugs.
func ListServerPidFiles ¶ added in v1.5.0
func ListServerPidFiles() []string
ListServerPidFiles returns paths to all server-*.pid files in the user state directory. Each file corresponds to a login node that may have (or have had) a server running. On NFS home dirs shared across login nodes, this reveals servers on other nodes.
func LoadDefaults ¶
func LoadDefaults(executablePath string)
func NormalizeCompressArgs ¶ added in v1.2.0
NormalizeCompressArgs is a thin wrapper around ArgsForCompress and exists for historical compatibility with earlier versions of the code.
func NormalizeConfigLayer ¶ added in v1.5.1
NormalizeConfigLayer expands a config layer shorthand to its full name. Returns the full name ("user", "app-root", "extra-root", "system") or the input unchanged. "root" and "r" are accepted as aliases for "app-root".
func ParseDirEntry ¶ added in v1.4.0
ParseDirEntry splits a dir entry ("path", "path:ro", or "path:rw") into (path, readOnly). :ro = force search-only (never written). :rw = explicit writable annotation (same as no marker). Default (no marker) is writable if filesystem perms allow — matches all other dir types.
func ReadConfigAllKeys ¶ added in v1.4.0
ReadConfigAllKeys returns all keys explicitly set in the config file at path.
func ReadConfigKey ¶ added in v1.4.0
ReadConfigKey reads a single key from a config file without touching global viper state. Returns "" if the file doesn't exist, can't be read, or the key is not set.
func ReadConfigSliceKey ¶ added in v1.4.0
ReadConfigSliceKey reads a string-slice key from a config file without touching global viper state. Returns nil if the file doesn't exist or the key is not set.
func ReadSavedServerPort ¶ added in v1.5.0
func ReadSavedServerPort() int
ReadSavedServerPort reads the port saved by a previous "server start --port" call. Returns 0 if no port has been saved or the file cannot be read.
func ResolveReadableConfigPath ¶ added in v1.4.0
ResolveReadableConfigPath resolves a config layer name to a config file path for reading. Unlike ResolveWritableConfigPath it does not check write permissions.
func ResolveWritableConfigPath ¶ added in v1.4.0
ResolveWritableConfigPath determines where a config-mutating command should write. If layer is non-empty it is resolved and checked for writability. If layer is empty the active config file is used when writable; otherwise falls back to the user config path, mirroring the config init smart-default behaviour.
Writability is checked on the config file itself, not just its directory: a read-only file in a writable directory (a frozen shared config) must not be treated as a valid write target.
func ResolveWritableConfigPathVerbose ¶ added in v1.5.1
func ResolveWritableConfigPathVerbose(layer string) (path, layerType, fellBackFrom string, err error)
ResolveWritableConfigPathVerbose is ResolveWritableConfigPath plus the layer it fell back from. fellBackFrom is empty unless an active config existed but was read-only, forcing the write down to the user layer — callers report that, since the change then applies only to the current user.
func SaveMinimalConfigTo ¶ added in v1.4.0
func SaveMinimalConfigTo(path, apptainerBin, schedulerBin, compressArgs string, lowerLayers []ConfigLayerInfo) error
SaveMinimalConfigTo writes only detected keys to path using a fresh viper instance, so no default values bleed in. Keys already provided by lowerLayers are skipped.
func SaveServerPort ¶ added in v1.5.0
SaveServerPort writes port to the shared saved-port file so it is reused on subsequent "server start" calls without --port.
func SetConfigKey ¶ added in v1.4.0
SetConfigKey sets a single key in the config file at path, creating it if needed. Existing keys are preserved. No-op if the file already has the key set to the same value.
func UpdateConfigKey ¶ added in v1.4.0
UpdateConfigKey reads path into a fresh viper instance, updates key to value, and writes the result back to path. No global viper state is affected. Creates the directory and file if needed (first-use creation).
func ValidateBinary ¶
ValidateBinary checks if a binary exists and is executable
Types ¶
type BuildConfig ¶
type BuildConfig struct {
Defaults scheduler.ResourceSpec // Default resource spec for build job submissions
TmpSizeMB int // Size of temporary overlay in MB
CompressArgs string // mksquashfs compression arguments
BlockSize string // mksquashfs block size for app/env/external overlays (default: 128k)
DataBlockSize string // mksquashfs block size for data/ref overlays (default: 1m)
UseTmpOverlay bool // Use a temporary overlay instead of a temp directory (default: false)
AlwaysSubmit bool // Always submit builds as scheduler jobs even without script directives (default: false)
Channels []string // conda channels in priority order (default: [conda-forge, bioconda])
}
BuildConfig holds default settings for build operations
type CompressOption ¶ added in v1.2.0
type CompressOption struct {
Name string // e.g. "lz4" or "zstd-fast"
Args string // full mksquashfs arguments
Description string // help text for CLI
}
CompressOption defines name, mksquashfs arguments, and description
type Config ¶
type Config struct {
// Runtime settings
Debug bool
SubmitJob bool
Version string
// Directory paths
ProgramDir string
LogsDir string
// Binary paths
ApptainerBin string
SchedulerBin string // Optional: path to sbatch/scheduler binary (auto-detected if empty)
// Base OS overlay slug (e.g. "ubuntu24"). Determines the base image filename:
// "ubuntu24" → "ubuntu24--base_image.sif". Defaults to "ubuntu24".
DefaultDistro string
// Remote repository settings
ScriptsLink string // Base remote URL (scripts_link config key; lowest priority)
ScriptsLinks []string // Effective ordered list: [extra_scripts_links..., scripts_link]
PreferRemote bool // Remote build scripts take precedence over local
// Dependency parsing
ParseModuleLoad bool // Parse "module load" / "ml" lines as dependencies (default: false)
// AutoloadGPU: if true (default), detect NVIDIA/ROCm GPUs on the host and
// automatically add --nv/--rocm to the apptainer invocation. When false,
// GPU detection is skipped entirely and neither flag is added.
AutoloadGPU bool
// Scheduler command timeout (default: 0 = no timeout).
SchedulerTimeout time.Duration
// Notification method when a helper job starts running (default: "web").
// Values: "web" (browser notification via dashboard), "terminal" (bell ×2, 1.1 s apart),
// "both" (terminal + web), "" or "none" (silent).
Notification string
// Max age of the on-disk remote build script metadata cache (default: 1 week)
MetadataCacheTTL time.Duration
// ProxyPerJob: if true, inject "condatainer proxy start --via <login-node>" at the
// top of every generated scheduler script so the compute node starts a per-job proxy.
ProxyPerJob bool
// HelperBindAll: if true, helper services bind to 0.0.0.0 and the server connects
// via direct TCP instead of SSH tunnel (for clusters where inter-node SSH is blocked).
HelperBindAll bool
// Build configuration
Build BuildConfig
}
Config holds global application settings
var Global Config
Global holds the singleton configuration instance
type ConfigLayerInfo ¶ added in v1.4.0
type ConfigLayerInfo struct {
Path string
Type string // "user", "extra-root", "root", "system"
// contains filtered or unexported fields
}
ConfigLayerInfo exposes one loaded config layer for per-layer display.
func GetConfigLayerInfos ¶ added in v1.4.0
func GetConfigLayerInfos() []ConfigLayerInfo
GetConfigLayerInfos returns all loaded config layers in priority order. Used by config show --sources to display per-layer value annotations.
func (ConfigLayerInfo) GetBool ¶ added in v1.5.0
func (l ConfigLayerInfo) GetBool(key string) bool
GetBool returns the bool value of key from this config layer.
func (ConfigLayerInfo) GetString ¶ added in v1.4.0
func (l ConfigLayerInfo) GetString(key string) string
GetString returns the string value of key from this config layer.
func (ConfigLayerInfo) GetStringSlice ¶ added in v1.4.0
func (l ConfigLayerInfo) GetStringSlice(key string) []string
GetStringSlice returns the string slice value of key from this config layer.
func (ConfigLayerInfo) InConfig ¶ added in v1.4.0
func (l ConfigLayerInfo) InConfig(key string) bool
InConfig reports whether key is explicitly set in this config file (not just a default).
type ConfigSearchPath ¶
type ConfigSearchPath struct {
Path string // Full path to config file
Type string // Type: "root", "extra-root", "user", "system"
Exists bool // Whether the file exists
InUse bool // Whether this is the active config file
}
ConfigSearchPath represents a config file location with metadata
func GetConfigSearchPaths ¶
func GetConfigSearchPaths() []ConfigSearchPath
GetConfigSearchPaths returns all config search paths in priority order. This matches the order used by InitViper. InUse is true for every config file that was loaded (all contribute via merging), not just the primary. Duplicate paths (e.g. CNT_EXTRA_ROOT == CNT_ROOT) are skipped.
type DataLayer ¶ added in v1.5.1
type DataLayer string
DataLayer identifies which tier a data directory belongs to. The short forms (u/r/e) match the -l/--layer vocabulary used by the config commands, so a single mental model covers both config files and data directories.
func ClassifyDataDir ¶ added in v1.5.1
ClassifyDataDir reports which layer a data directory belongs to, by comparing its parent against each tier root. Tiers are checked in search-path order, so a directory shared by two tiers (e.g. CNT_ROOT == $SCRATCH/condatainer) is labelled with the higher-priority one, matching how lookups resolve it.
func ParseDataLayer ¶ added in v1.5.1
ParseDataLayer resolves a user-supplied layer name or its short form.
type DataPaths ¶
type DataPaths struct {
ImagesDirs []string // Search paths for images
BuildScriptsDirs []string // Search paths for build scripts
HelperScriptsDirs []string // Search paths for helper scripts
}
DataPaths holds the search paths for data directories. Search order: extra → root → scratch → user (first match wins for lookups). Write operations go to the first writable path in the same order.
var GlobalDataPaths DataPaths
GlobalDataPaths holds the computed data paths.
type SearchDir ¶ added in v1.4.0
SearchDir is a candidate directory for write operations. Personal dirs (scratch, XDG user) are always created on first use via EnsureWritableDir. Shared dirs (CNT_EXTRA_ROOT, root, extra_*_dirs): subdirs are created if the parent exists, but the parent itself is never auto-created.
type ServerState ¶ added in v1.5.0
type ServerState struct {
Host string `json:"host"`
Port int `json:"port"`
Token string `json:"token"`
PID int `json:"pid"`
Daemon bool `json:"daemon"` // Saved for 'server restart' using same daemon mode.
}
ServerState is the JSON written to the server PID file (NFS-visible).