Hub 2.8.0: an install's .env on its page, changed with a restart
- Settings (.env) panel on an Events or Accounts install: reads the .env through an env-read job (addresses first; secrets only as set or not), and changes plain values with an env-set job (restart, or rebuild for the frontend's file; the server puts the file back if the site doesn't start). After a change the file is read again. One change per install at a time. - Contracts 1.12.0 vendored (env jobs need agent 1.3.0). - env-read / env-set in the Jobs type filter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -195,6 +195,24 @@ router.post('/deployments/:id/demo', wrap(async (req, res) => {
|
||||
res.json({ isDemo: d.isDemo });
|
||||
}));
|
||||
|
||||
// An install's .env (2.8.0): the last read (secrets only as set or not), read it again, change values.
|
||||
router.get('/deployments/:id/env', wrap(async (req, res) => {
|
||||
res.json(await jobs.envState(req.params.id));
|
||||
}));
|
||||
|
||||
router.post('/deployments/:id/env/read', wrap(async (req, res) => {
|
||||
const job = await jobs.readEnv(req.params.id, req.admin);
|
||||
res.status(201).json({ job });
|
||||
}));
|
||||
|
||||
router.post('/deployments/:id/env', wrap(async (req, res) => {
|
||||
const body = req.body || {};
|
||||
const job = await jobs.setEnv(req.params.id, { file: body.file, set: body.set, unset: body.unset, restart: body.restart }, req.admin);
|
||||
// Names only in the audit log, as on the server: values can be personal (an admin's email).
|
||||
await audit(req, 'install_env_change_queued', req.params.id, { job: job.id, file: job.args.file, set: Object.keys(job.args.set), unset: job.args.unset, restart: job.args.restart });
|
||||
res.status(201).json({ job });
|
||||
}));
|
||||
|
||||
router.post('/deployments/:id/seed-demo', wrap(async (req, res) => {
|
||||
const job = await jobs.seedDemo({ deploymentId: req.params.id, profile: req.body?.profile, confirm: req.body?.confirm }, req.admin);
|
||||
await audit(req, 'demo_seed_queued', req.params.id, { job: job.id, profile: job.args.profile });
|
||||
|
||||
Reference in New Issue
Block a user