feat: .NET appsettings files in repos
appsettings.json and appsettings.<Environment>.json tracked by git are listed under Repos, keys named as .NET names them (ConnectionStrings:Default). - The secret patterns pick the keys, the rest hidden, with dotnet.secretPatterns for .NET files' own. - An App Service Key Vault reference, @Microsoft.KeyVault(…), is marked as a reference; a BOM at the start is fine. - A .NET icon, themeable with dotnetColor.
This commit is contained in:
17 files changed
+224
-22
No files matched your search
@@ -145,8 +145,8 @@ func (m Model) objectRender() func(styles.Styles, provider.Object, int) string {
|
||||
}
|
||||
|
||||
// fileIcon is a repo file's icon, in its colour: a lock for an encrypted
|
||||
// one, a leaf for Spring config, a whale for compose, a file in the
|
||||
// warning colour for plain text; "" for other vaults, or without icons.
|
||||
// one, a leaf for Spring config, a whale for compose, .NET's for
|
||||
// appsettings, a file in the warning colour for plain text; "" for other vaults, or without icons.
|
||||
func (m Model) fileIcon(sty styles.Styles, c provider.Container) string {
|
||||
if c.Source.Kind != provider.KindRepo {
|
||||
return ""
|
||||
@@ -157,6 +157,8 @@ func (m Model) fileIcon(sty styles.Styles, c provider.Container) string {
|
||||
icon, style = m.icons.Spring, sty.Spring
|
||||
case strings.HasPrefix(c.Detail, "compose"):
|
||||
icon, style = m.icons.Compose, sty.Compose
|
||||
case strings.HasPrefix(c.Detail, "dotnet"):
|
||||
icon, style = m.icons.Dotnet, sty.Dotnet
|
||||
case !strings.HasPrefix(c.Detail, "sops"):
|
||||
icon, style = m.icons.PlainFile, sty.Warning
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ type Set struct {
|
||||
PlainFile string // a plain text secrets file (.env)
|
||||
Spring string // a Spring Boot config file
|
||||
Compose string // a Docker Compose file
|
||||
Dotnet string // a .NET appsettings file
|
||||
Note string // has a note (lazysecrets list)
|
||||
}
|
||||
|
||||
@@ -29,6 +30,7 @@ var NerdFont = Set{
|
||||
PlainFile: "\U000F0214", // md-file
|
||||
Spring: "\U000F032A", // md-leaf
|
||||
Compose: "\U000F0868", // md-docker
|
||||
Dotnet: "\U000F0AAE", // md-dot_net
|
||||
Note: "\U000F09ED",
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ func (m *Map) Actions() []Action {
|
||||
a(Lists, "prevTab", &m.PrevTab, "prev tab", "lists", "Previous tab of the focused pane: Sources and Favourites in Sources; Secrets, Keys, Certs in Secrets."),
|
||||
a(Lists, "nextTab", &m.NextTab, "next tab", "lists", "Next tab of the focused pane."),
|
||||
a(Lists, "sourcesView", &m.SourcesView, "grouped/flat sources", "lists", "Switch the Sources pane between grouped by provider and a flat list."),
|
||||
a(Lists, "toggleHidden", &m.ToggleHidden, "show/hide hidden", "lists", "Show or hide what's hidden: Spring and compose keys that don't look like secrets, example files (.env.example), and files and repos with only those. Shown, they're dimmed; Go to finds them too."),
|
||||
a(Lists, "toggleHidden", &m.ToggleHidden, "show/hide hidden", "lists", "Show or hide what's hidden: config file keys (Spring, compose, .NET) that don't look like secrets, example files (.env.example), and files and repos with only those. Shown, they're dimmed; Go to finds them too."),
|
||||
a(Lists, "star", &m.Favourite, "star", "lists", "Star or unstar the selected subscription, vault or secret, for the account showing it. Starred items get a ★ and sort first."),
|
||||
a(Lists, "goTo", &m.Search, "search", "lists", "Go to anything: search every vault and secret loaded and jump to one. Again in Go to: only the source or group you're in, and back to all. On the left, the scope: All, an account (or Databricks, or Repos), or one source (○ ◐ ● for how much of it is loaded)."),
|
||||
a(Lists, "favourites", &m.Favourites, "favourites", "lists", "Go to, on Favourites: everything you've starred, to search and jump to."),
|
||||
|
||||
@@ -36,6 +36,7 @@ type Styles struct {
|
||||
KindRepo lipgloss.Style
|
||||
Spring lipgloss.Style // Spring Boot config files
|
||||
Compose lipgloss.Style // Docker Compose files
|
||||
Dotnet lipgloss.Style // .NET appsettings files
|
||||
|
||||
// themed marks the selection colours as set by the theme, so
|
||||
// OnBackground leaves them.
|
||||
@@ -74,6 +75,7 @@ func Default() Styles {
|
||||
KindRepo: lipgloss.NewStyle().Foreground(lipgloss.Magenta),
|
||||
Spring: lipgloss.NewStyle().Foreground(lipgloss.Green),
|
||||
Compose: lipgloss.NewStyle().Foreground(lipgloss.Blue),
|
||||
Dotnet: lipgloss.NewStyle().Foreground(lipgloss.BrightMagenta),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ var Roles = map[string]string{
|
||||
"repoColor": "repos and their secret files (SOPS)",
|
||||
"springColor": "Spring Boot config files",
|
||||
"composeColor": "Docker Compose files",
|
||||
"dotnetColor": ".NET appsettings files",
|
||||
}
|
||||
|
||||
// FromTheme returns the default styles with the theme's roles applied, and
|
||||
@@ -105,6 +106,8 @@ func FromTheme(theme map[string][]string) (Styles, color.Color, error) {
|
||||
st.Spring = v.fg(lipgloss.NewStyle())
|
||||
case "composeColor":
|
||||
st.Compose = v.fg(lipgloss.NewStyle())
|
||||
case "dotnetColor":
|
||||
st.Dotnet = v.fg(lipgloss.NewStyle())
|
||||
}
|
||||
}
|
||||
return st, fg, nil
|
||||
|
||||
Reference in new issue
Block a user