Files
lazysecrets/internal/ui/icons/icons.go
T
keb b677201e34
CI / Checks (pull_request) Successful in 37s
PR title / Conventional title (pull_request) Successful in 1s
feat: Spring Boot config files in repos
application*.properties/.yml and bootstrap* files tracked by git are
listed under Repos, with their secret-looking keys as secrets.

- Keys whose name ends like a secret (password, secret, token, key, …)
  or whose value looks like one (Jasypt ENC(...), a URL or connection
  string with a password) are listed; providers.repos.spring.keys and
  .values replace the patterns, also in a repo's .lazysecrets.yaml.
- A file's details count the keys left out; ${VAR} values are marked
  as references, and a tracked file is only marked red when a listed
  value is in plain text.
- Later YAML/properties documents name their keys after the profile:
  spring.datasource.password (prod).
- Maven's @placeholders@ parse; Argo CD's applications.yaml and Helm
  templates aren't Spring files.
- A green leaf icon, themeable with springColor.
2026-10-15 13:10:05 +02:00

50 lines
1.3 KiB
Go

// Package icons maps backends to Nerd Font glyphs. They are on by default
// and can be turned off, since they render as boxes without a Nerd Font
// (v3+) installed.
package icons
import "git.kebcloud.no/keb/lazysecrets/internal/provider"
type Set struct {
Azure string
Databricks string
Repo string
Encrypted string // an encrypted file (SOPS)
PlainFile string // a plain text secrets file (.env)
Spring string // a Spring Boot config file
Note string // has a note (lazysecrets list)
}
// None renders no icons.
var None = Set{}
// NerdFont uses Nerd Fonts v3 Material Design glyphs. There is no Databricks
// logo glyph, so it uses stacked layers, which resembles it.
var NerdFont = Set{
Azure: "\U000F0805", // md-microsoft_azure
Databricks: "\U000F0F58", // md-layers_triple
Repo: "\U000F02A2", // md-git
Encrypted: "\U000F033E", // md-lock
PlainFile: "\U000F0214", // md-file
Spring: "\U000F032A", // md-leaf
Note: "\U000F09ED",
}
// Prefix returns the icon for kind followed by a space, or "" if the set has
// no icon for it.
func (s Set) Prefix(kind provider.Kind) string {
var icon string
switch kind {
case provider.KindAzure:
icon = s.Azure
case provider.KindDatabricks:
icon = s.Databricks
case provider.KindRepo:
icon = s.Repo
}
if icon == "" {
return ""
}
return icon + " "
}