feat: decrypt Jasypt values in .env and Spring files (#80)
Co-authored-by: Karl-Einar Bergstrøm <karl-einarb@outlook.com>
This commit was merged in pull request #80.
This commit is contained in:
1 parent
96395cb6a2
commit
17da9eaa32
13 files changed
+381
-29
No files matched your search
@@ -137,6 +137,9 @@ func (m Model) objectRender() func(styles.Styles, provider.Object, int) string {
|
||||
line = sty.Muted.Render(o.Name + " (disabled)")
|
||||
}
|
||||
line = marks(sty, n, o.Container.Source.Provider, m.recentIcon, m.now()) + line
|
||||
if o.Detail != "" {
|
||||
line += sty.Muted.Render(" " + o.Detail)
|
||||
}
|
||||
switch state, left := m.expiry(o); state {
|
||||
case expiry.Expired:
|
||||
line += " " + sty.Error.Render("✗ expired")
|
||||
|
||||
@@ -38,11 +38,13 @@ func (m *Model) storeEntries() (favs, recent []option) {
|
||||
return nil
|
||||
}
|
||||
var out []entry
|
||||
detail := m.objectDetail(key)
|
||||
add := func(path []string, acct string, depth int, run func(*Model) tea.Cmd) {
|
||||
account := ""
|
||||
if p, ok := m.byID[acct]; ok {
|
||||
account = accountOf(provider.Source{Kind: p.Kind(), ProviderLabel: p.Label()})
|
||||
}
|
||||
account = strings.Trim(detail+" · "+account, " ·")
|
||||
sort := strings.ToLower(strings.Join(path, "/")) + " " + account
|
||||
out = append(out, entry{depth, sort, option{
|
||||
label: m.pathLabel(r.Kind, path, account), note: n.Note, mark: " ",
|
||||
@@ -157,6 +159,19 @@ func (m Model) inPlainEnv(r ref.Ref) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// objectDetail is the Detail of the secret with the store key key, as far
|
||||
// as the lists loaded tell.
|
||||
func (m Model) objectDetail(key string) string {
|
||||
for _, e := range m.cache.objects {
|
||||
for _, o := range e.value {
|
||||
if o.Detail != "" && objectKey(o) == key {
|
||||
return o.Detail
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// repoLabel draws a repo, or a file in it, as everywhere else: the repo
|
||||
// icon and colour, "app / apps/api/.env".
|
||||
func (m Model) repoLabel(repo string, file ...string) string {
|
||||
|
||||
@@ -90,7 +90,7 @@ func (m *Model) searchEntries() (sources, items []option) {
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
suffix := accountOf(src)
|
||||
suffix := strings.Trim(o.Detail+" · "+accountOf(src), " ·")
|
||||
if t != provider.TypeSecret {
|
||||
typ := strings.TrimSuffix(strings.ToLower(pluralLabels[t]), "s") // "key"
|
||||
suffix = strings.Trim(typ+" · "+suffix, " ·")
|
||||
|
||||
Reference in new issue
Block a user