fix(delmia-notifier)+chore(docker): review follow-ups — trim the env key like the file key, log which source supplied the key (never the key), hoist the not-configured message; README warns never to commit a filled-in appsettings.json; design-doc body lines updated; seed-delmia-api.sh no longer hides CLI errors and notes key names are not unique
Claude-Session: https://claude.ai/code/session_013L3XdmVii9i5sY4FChU8pB
This commit is contained in:
@@ -88,12 +88,16 @@ Placed next to the exe (copied to the output on build/publish):
|
||||
|
||||
The inbound API key is sent as `X-API-Key`. It is resolved from **`SCADABRIDGE_API_KEY`** first
|
||||
(recommended for production — the key never touches disk), falling back to **`ScadaBridge:ApiKey`** in
|
||||
`appsettings.json` when the variable is unset or blank. If neither is set → `NO` +
|
||||
`appsettings.json` when the variable is unset or blank (a blank file value counts as unset too; both
|
||||
values are trimmed). The diagnostic log records which source supplied the key — never the key itself — so
|
||||
a stale environment variable silently shadowing an edited file is visible. If neither is set → `NO` +
|
||||
`API key not configured (SCADABRIDGE_API_KEY or ScadaBridge:ApiKey)`, exit `-1`, no HTTP attempt.
|
||||
|
||||
Set the variable on the machine/account that DELMIA runs under (e.g. a system/user environment
|
||||
variable, or the service account's environment). If you use the file instead, restrict its ACL to the
|
||||
account DELMIA runs under — the key is stored in plain text there.
|
||||
account DELMIA runs under — the key is stored in plain text there. Fill `ApiKey` in **only on the deployed
|
||||
copy**: the repo's `appsettings.json` is tracked and copied to the build output, so a key pasted there to
|
||||
test locally is one `git add` away from being committed. It must stay `""` in source control.
|
||||
|
||||
## Building & publishing (Native AOT, `win-x64`)
|
||||
|
||||
@@ -106,7 +110,8 @@ dotnet publish src/ZB.MOM.WW.ScadaBridge.DelmiaNotifier -c Release -r win-x64
|
||||
# → bin/Release/net10.0/win-x64/publish/WWNotifier.exe (+ appsettings.json)
|
||||
```
|
||||
|
||||
Copy `WWNotifier.exe` **and** `appsettings.json` to the Delmia host, set `SCADABRIDGE_API_KEY`, and
|
||||
Copy `WWNotifier.exe` **and** `appsettings.json` to the Delmia host, set `SCADABRIDGE_API_KEY` (or fill in
|
||||
`ScadaBridge:ApiKey` on that copy), and
|
||||
point `BaseUrls` at the central node(s).
|
||||
|
||||
> Managed `dotnet build` / `dotnet test` run cross-platform and are the development/CI gate; only the
|
||||
|
||||
Reference in New Issue
Block a user