feat: .NET appsettings files in repos (#88)

Co-authored-by: Karl-Einar Bergstrøm <karl-einarb@outlook.com>
This commit was merged in pull request #88.
This commit is contained in:
keb authored and Karl-Einar Bergstrøm committed 2026-10-15 16:40:00 +02:00
1 parent 59c1222f4d
commit a7db795cbe
17 files changed
+224 -22

No files matched your search

+1
View File
@@ -76,6 +76,7 @@ theme:
repoColor: ["#c099ff"]
springColor: ["#c3e88d"] # Spring Boot config files
composeColor: ["#82aaff"] # Docker Compose files
dotnetColor: ["#c099ff"] # .NET appsettings files
```
A role lazysecrets doesn't know, a typo or one from a newer version, is
+2 -2
View File
@@ -20,7 +20,7 @@ The rule: a letter in the lists, ctrl+ that letter where you type a filter
| `[` / `]` | previous / next tab of the focused pane: Sources and Favourites in Sources; Secrets, Keys, Certs in Secrets |
| `/` | filter the focused list by name or note ([how it matches](#searching)); `enter` keeps it, `esc` clears it. While typing: `ctrl+j`/`ctrl+k` move, `ctrl+y` copies, `ctrl+r` reveals, `ctrl+f` stars |
| `` ` `` | switch the Sources pane between grouped by provider and a flat list; `enter`/`space` on a provider folds it |
| `H` | show / hide what's hidden: [Spring and compose keys](repos.md#spring-boot-config) that don't look secret, example files, and files and repos with only those; shown dimmed |
| `H` | show / hide what's hidden: [config file keys](repos.md#spring-boot-config) (Spring, compose, .NET) that don't look secret, example files, and files and repos with only those; shown dimmed |
| `r` | refresh the focused pane |
| `q`, `ctrl+c` | quit |
@@ -54,7 +54,7 @@ match case exactly.
| `Y` | copy the reference (`@Microsoft.KeyVault(...)`, key/certificate URL, `{{secrets/scope/key}}`) |
| `v` | versions of the selected item (Azure); `space`/`y`/`Y` then act on that version; `esc`, `⌫` or `v` to go back |
| `o` | open the selected item in the browser (over SSH: copy the link) |
| `e` | open the selected SOPS, `.env`, Spring or compose file, or a secret's file at its line ([how](repos.md#opening-files)) |
| `e` | open the selected SOPS, `.env`, Spring, compose or .NET file, or a secret's file at its line ([how](repos.md#opening-files)) |
| `s` / `S` | copy a [link](sharing.md) to the selected item / share menu (also env files, [encrypted](sharing.md#sharing-env-files)) |
| `ctrl+o` | open a link or reference (or just paste one) |
| `x` | [custom commands](custom-commands.md) |
+18 -6
View File
@@ -1,9 +1,10 @@
# SOPS, .env, Spring and compose files in git repos
# SOPS, .env, Spring, compose and .NET files in git repos
lazysecrets shows git repositories under **Repos**: their
[SOPS](https://github.com/getsops/sops)-encrypted files (YAML, JSON,
`.env`, INI), plain env files, [Spring Boot config](#spring-boot-config)
and [Docker Compose files](#docker-compose) as vaults, and the keys in them (`db.password`, `list[0]`) as secrets. A dot or bracket inside a key is
[Docker Compose files](#docker-compose) and [.NET appsettings](#net-appsettings)
as vaults, and the keys in them (`db.password`, `list[0]`) as secrets. A dot or bracket inside a key is
escaped, `app\.name`, so it doesn't read as nesting.
## Which repos
@@ -47,7 +48,7 @@ Folders of dependencies and caches are never looked in, tracked or not:
3. where the repo's `.sops.yaml` `creation_rules` say SOPS files go,
4. the whole repo.
`include`/`exclude` apply to env, Spring and compose files too.
`include`/`exclude` apply to env, Spring, compose and .NET files too.
```yaml
providers:
@@ -106,8 +107,8 @@ providers:
```
A repo's `.lazysecrets.yaml` can set them too, the same way
(`secretPatterns:`, `spring: secretPatterns:`, `compose:
secretPatterns:`), for everyone. Each list
(`secretPatterns:`, `spring:`, `compose:` or `dotnet: secretPatterns:`),
for everyone. Each list
comes from the first that sets it: the repo's for the type, the repo's,
the config's for the type, the config's, the defaults.
@@ -133,6 +134,17 @@ without a value (`DB_PASSWORD:`, `- DB_PASSWORD`), taken from where
compose runs, are marked as references; `${DB_PASSWORD:-x}` has its
default in the file.
## .NET appsettings
`appsettings.json` and `appsettings.<Environment>.json`, tracked by git.
Keys are named as .NET's configuration names them, sections joined by
colons: `ConnectionStrings:Default`, `Servers:0:Name`. The same
[secret patterns](#spring-boot-config) pick them, the rest hidden, with
`dotnet: secretPatterns:` for .NET files' own; a connection string with
`Password=` is listed by its value. An App Service Key Vault reference,
`@Microsoft.KeyVault(…)`, is marked as a reference. Jasypt values decrypt
with `$JASYPT_ENCRYPTOR_PASSWORD` only.
## Decrypting
Listing never decrypts: SOPS and Jasypt encrypt values only, so keys and
@@ -151,7 +163,7 @@ repo's history, or easily could be.
### Jasypt
A value like `ENC(...)` in a plain `.env`, Spring or compose file is
A value like `ENC(...)` in a plain `.env`, Spring, compose or .NET file is
[Jasypt](http://www.jasypt.org)'s, decrypted when it's revealed or copied
with jasypt-spring-boot's default algorithm (3.0+:
`PBEWITHHMACSHA512ANDAES_256`). The password is, as in Spring: