v2.31.0-dev21 b59533b

config.go RawHistoryFolder

1package in
2
3import (
4	"context"
5
6	"github.com/bnema/gordon/internal/domain"
7)
8
9// ConfigService defines the contract for configuration management.
10type ConfigService interface {
11	// Load loads the configuration from the configured source.
12	Load(ctx context.Context) error
13
14	// Reload re-reads the configuration file from disk and loads it into memory.
15	// This is different from Load() which only loads from the cached viper values.
16	Reload(ctx context.Context) error
17
18	// GetRoutes returns all configured routes.
19	GetRoutes(ctx context.Context) []domain.Route
20
21	// GetRoute returns a single route by domain.
22	GetRoute(ctx context.Context, domain string) (*domain.Route, error)
23
24	// FindRoutesByImage returns all routes that match the given image name.
25	// Image names are normalized by stripping the registry domain prefix before comparison.
26	FindRoutesByImage(ctx context.Context, imageName string) []domain.Route
27
28	// AddRoute adds a new route to the configuration.
29	AddRoute(ctx context.Context, route domain.Route) error
30
31	// UpdateRoute updates an existing route.
32	UpdateRoute(ctx context.Context, route domain.Route) error
33
34	// RemoveRoute removes a route from the configuration.
35	RemoveRoute(ctx context.Context, domain string) error
36
37	// Save persists the current configuration to disk.
38	Save(ctx context.Context) error
39
40	// Watch starts watching for configuration changes.
41	// The onChange callback is called when configuration changes are detected.
42	Watch(ctx context.Context, onChange func()) error
43
44	// GetServerPort returns the configured server port.
45	GetServerPort() int
46
47	// GetRegistryPort returns the configured registry port.
48	GetRegistryPort() int
49
50	// GetRegistryDomain returns the configured registry domain.
51	GetRegistryDomain() string
52
53	// GetDataDir returns the configured data directory.
54	GetDataDir() string
55
56	// IsAutoRouteEnabled returns whether auto-route is enabled.
57	IsAutoRouteEnabled() bool
58
59	// IsNetworkIsolationEnabled returns whether network isolation is enabled.
60	IsNetworkIsolationEnabled() bool
61
62	// GetNetworkPrefix returns the prefix for created networks.
63	GetNetworkPrefix() string
64
65	// GetExternalRoutes returns all configured external routes.
66	GetExternalRoutes() map[string]string
67
68	// GetAllAttachments returns all configured attachments.
69	GetAllAttachments(ctx context.Context) map[string][]string
70
71	// GetAttachmentsFor returns attachments for a specific domain or network group.
72	GetAttachmentsFor(ctx context.Context, domainOrGroup string) ([]string, error)
73
74	// FindAttachmentTargetsByImage returns all attachment targets that match the given image name.
75	FindAttachmentTargetsByImage(ctx context.Context, imageName string) []string
76
77	// AddAttachment adds an image to a domain/group's attachments.
78	AddAttachment(ctx context.Context, domainOrGroup, image string) error
79
80	// RemoveAttachment removes an image from a domain/group's attachments.
81	RemoveAttachment(ctx context.Context, domainOrGroup, image string) error
82
83	// Auto-route domain allowlist
84	GetAutoRouteAllowedDomains(ctx context.Context) ([]string, error)
85	AddAutoRouteAllowedDomain(ctx context.Context, pattern string) error
86	RemoveAutoRouteAllowedDomain(ctx context.Context, pattern string) error
87
88	// Preview and auto config
89	GetPreviewConfig() domain.PreviewConfig
90	IsPreviewEnabled() bool
91	IsAutoEnabled() bool
92	GetPreviewTagPatterns() []string
93	GetAllowedDomains() []string
94}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close