create-loopengine 0.1.34 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/adapters/http.ts +11 -0
package/package.json
CHANGED
|
@@ -975,6 +975,17 @@ async function handleEnvPut(req: IncomingMessage, res: ServerResponse, agentName
|
|
|
975
975
|
res.writeHead(400, { 'content-type': 'application/json' }).end(JSON.stringify({ error: 'value is required' }))
|
|
976
976
|
return
|
|
977
977
|
}
|
|
978
|
+
// A dropdown-backed var (AbilityEnvDecl.options) is still writable
|
|
979
|
+
// through this same raw route — worth rejecting an out-of-set value
|
|
980
|
+
// here too, not just skipping validation because the Admin UI's own
|
|
981
|
+
// <select> would never have produced one.
|
|
982
|
+
const declared = listDeclaredEnvVars(agentName).find((v) => v.name === varName)
|
|
983
|
+
if (declared?.options && !declared.options.includes(body.value)) {
|
|
984
|
+
res.writeHead(400, { 'content-type': 'application/json' }).end(
|
|
985
|
+
JSON.stringify({ error: `"${body.value}" isn't one of this var's allowed values: ${declared.options.join(', ')}` }),
|
|
986
|
+
)
|
|
987
|
+
return
|
|
988
|
+
}
|
|
978
989
|
try {
|
|
979
990
|
setEnvVar(varName, body.value)
|
|
980
991
|
} catch (err) {
|