Documentation
¶
Index ¶
- func CanonicalPath(path string) string
- func Home() (string, error)
- func MakeID(customer, name string) string
- func Path() (string, error)
- func Save(reg Registry) error
- func SetTrustedDigests(reg *Registry, id string, files map[string]string) bool
- func TrustedDigests(reg Registry, id string) map[string]string
- func Upsert(reg *Registry, id string, project Project)
- func UpsertCredentialSet(reg *Registry, customerID, setID string, set CredentialSet)
- func UpsertCustomer(reg *Registry, id string, customer Customer)
- type CredentialSet
- type Customer
- type GitInfo
- type Project
- type Registry
- type TrustRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalPath ¶ added in v0.2.0
CanonicalPath makes two spellings of the same directory comparable: absolute, cleaned, and with symlinks resolved.
Resolving matters because the answer decides whether a directory counts as registered, and registration is what devvault requires before it mounts any credentials. On macOS /tmp and /var are symlinks, so a registry entry recorded as /var/x and a working directory reported as /private/var/x are the same directory; without resolving, devvault would treat a registered project as unregistered and refuse to work with it.
A path that does not exist cannot be resolved, in which case the cleaned absolute form is the best available answer.
func SetTrustedDigests ¶ added in v0.2.0
SetTrustedDigests replaces the approved digests of a project. It reports whether the project exists; approvals for unknown projects are dropped instead of silently creating a registry entry.
func TrustedDigests ¶ added in v0.2.0
TrustedDigests returns the approved file digests of a project. The result is a copy and is never nil, so callers can read it without a registry lock.
func UpsertCredentialSet ¶
func UpsertCredentialSet(reg *Registry, customerID, setID string, set CredentialSet)
func UpsertCustomer ¶
Types ¶
type CredentialSet ¶
type CredentialSet struct {
Profile string `yaml:"profile"`
Mount string `yaml:"mount"`
AuthMethod string `yaml:"auth_method"`
}
func ResolveCredentialSet ¶
func ResolveCredentialSet(reg Registry, project Project) (CredentialSet, bool)
type Customer ¶
type Customer struct {
Name string `yaml:"name,omitempty"`
DefaultWorkspace string `yaml:"default_workspace,omitempty"`
CredentialSets map[string]CredentialSet `yaml:"credential_sets,omitempty"`
}
type Project ¶
type Project struct {
Alias string `yaml:"alias,omitempty"`
Customer string `yaml:"customer"`
Name string `yaml:"name"`
CredentialSet string `yaml:"credential_set,omitempty"`
Path string `yaml:"path"`
GitURL string `yaml:"git_url,omitempty"`
Git GitInfo `yaml:"git,omitempty"`
Backend string `yaml:"backend,omitempty"`
LastOpened time.Time `yaml:"last_opened,omitempty"`
Trust *TrustRecord `yaml:"trust,omitempty"`
}
func FindByPath ¶ added in v0.2.0
FindByPath returns the project registered for path. Callers that only know where a repository lives — not under which id it was registered — use it to reach the user-owned data for that repository.
type Registry ¶
type TrustRecord ¶ added in v0.2.0
type TrustRecord struct {
ApprovedAt time.Time `yaml:"approved_at"`
// Files maps a repository-relative path to "sha256:<hex>".
Files map[string]string `yaml:"files"`
}
TrustRecord holds the digests of the devvault-managed repository files the user approved for a project. It lives in the user-owned registry, never in the repository, so a repository can never approve itself.