2026-03-01 01:21:33 +00:00
|
|
|
import type { EnvVar } from "../../lib/types";
|
2026-08-09 11:35:42 -07:00
|
|
|
import Modal from "../ui/Modal";
|
|
|
|
|
import Button from "../ui/Button";
|
|
|
|
|
import EnvVarsEditor from "./EnvVarsEditor";
|
2026-03-01 01:21:33 +00:00
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
envVars: EnvVar[];
|
|
|
|
|
disabled: boolean;
|
|
|
|
|
onSave: (vars: EnvVar[]) => Promise<void>;
|
|
|
|
|
onClose: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-09 11:35:42 -07:00
|
|
|
/** Global env vars (Settings). Per-project vars live inline in Config → Access. */
|
|
|
|
|
export default function EnvVarsModal({ envVars, disabled, onSave, onClose }: Props) {
|
2026-03-01 01:21:33 +00:00
|
|
|
return (
|
2026-08-09 11:35:42 -07:00
|
|
|
<Modal
|
|
|
|
|
title="Environment Variables"
|
|
|
|
|
onClose={onClose}
|
|
|
|
|
widthClassName="w-[36rem]"
|
|
|
|
|
footer={<Button onClick={onClose}>Close</Button>}
|
2026-03-01 01:21:33 +00:00
|
|
|
>
|
2026-08-09 11:35:42 -07:00
|
|
|
<EnvVarsEditor
|
|
|
|
|
envVars={envVars}
|
|
|
|
|
disabled={disabled}
|
|
|
|
|
disabledReason="Container must be stopped to change environment variables."
|
|
|
|
|
onSave={async (vars) => {
|
|
|
|
|
try {
|
|
|
|
|
await onSave(vars);
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error("Failed to update environment variables:", err);
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</Modal>
|
2026-03-01 01:21:33 +00:00
|
|
|
);
|
|
|
|
|
}
|