discovery

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package discovery finds Docker Compose projects on disk under user-configured roots, so the UI can offer "available but not yet deployed" stacks alongside the label-derived running ones. It is read-only: it parses just enough of each compose file (its name and service count) and never executes anything.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListDirs

func ListDirs(input string) (string, []string, error)

ListDirs returns the immediate child directories of the typed path, for the Settings path typeahead (Radarr-style). It splits a partial input into a directory plus a name prefix and lists matching subdirectories.

func Resolve

func Resolve(file, dir string) (name string, ownName bool, services int)

Resolve parses a compose file for its project name and service count. If the file declares a top-level `name:`, that wins (ownName=true → don't pass -p on up); otherwise the name derives from the directory.

Types

type Config

type Config struct {
	Roots   []Root            `json:"roots"`
	Filter  Filter            `json:"filter"`
	Aliases map[string]string `json:"aliases"` // normalized project name → Oriel display name
}

Config is the persisted discovery configuration.

type Discovered

type Discovered struct {
	Name     string `json:"name"`     // normalized project name (the identity)
	Alias    string `json:"alias"`    // Oriel display name, if set (display only)
	Dir      string `json:"dir"`      // project directory
	File     string `json:"file"`     // canonical compose file
	Services int    `json:"services"` // service count, -1 if unparseable
}

Discovered is one compose project found on disk.

type Filter

type Filter struct {
	Mode     string   `json:"mode"`
	Patterns []string `json:"patterns"`
}

Filter restricts which discovered stacks surface. Mode "off" shows all; "allow" shows only matches; "deny" hides matches. Running stacks are never affected — the filter is applied to discovery results only.

func (Filter) Allows

func (f Filter) Allows(d Discovered) bool

Allows reports whether a discovered stack passes the filter. Patterns match a project's name, its Oriel alias, or its directory path (path globs may use **).

type Root

type Root struct {
	ID       string `json:"id"`
	Path     string `json:"path"`
	Traverse bool   `json:"traverse"`
	Enabled  bool   `json:"enabled"`
}

Root is one configured search location.

type RootResult

type RootResult struct {
	ID    string `json:"id"`
	Found int    `json:"found"`
	Error string `json:"error,omitempty"`
}

RootResult reports per-root scan feedback for the Settings UI.

type ScanResult

type ScanResult struct {
	Stacks []Discovered `json:"stacks"`
	Roots  []RootResult `json:"roots"`
}

ScanResult is the full output of a scan.

func Scan

func Scan(cfg Config) ScanResult

Scan walks all enabled roots, de-duplicates by compose-file path, applies display aliases, and reports per-root feedback. Filtering and deployed-stack exclusion happen in the caller (which has the live container list).

Jump to

Keyboard shortcuts

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