|
@@ -10,16 +10,17 @@ import { type PorterAppFormData } from "lib/porter-apps";
|
|
|
|
|
|
|
|
type HealthProps = {
|
|
type HealthProps = {
|
|
|
index: number;
|
|
index: number;
|
|
|
- command?: boolean;
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const Health: React.FC<HealthProps> = ({ index, command = false }) => {
|
|
|
|
|
|
|
+const Health: React.FC<HealthProps> = ({ index }) => {
|
|
|
const { register, control, watch } = useFormContext<PorterAppFormData>();
|
|
const { register, control, watch } = useFormContext<PorterAppFormData>();
|
|
|
|
|
|
|
|
const healthCheckEnabled = watch(
|
|
const healthCheckEnabled = watch(
|
|
|
`app.services.${index}.config.healthCheck.enabled`
|
|
`app.services.${index}.config.healthCheck.enabled`
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
+ const serviceType = watch(`app.services.${index}.config.type`);
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<Spacer y={1} />
|
|
<Spacer y={1} />
|
|
@@ -60,29 +61,29 @@ const Health: React.FC<HealthProps> = ({ index, command = false }) => {
|
|
|
)}
|
|
)}
|
|
|
/>
|
|
/>
|
|
|
{healthCheckEnabled.value &&
|
|
{healthCheckEnabled.value &&
|
|
|
- (command ? (
|
|
|
|
|
|
|
+ (serviceType === "web" ? (
|
|
|
<>
|
|
<>
|
|
|
<Spacer y={0.5} />
|
|
<Spacer y={0.5} />
|
|
|
- <Text>Health check command</Text>
|
|
|
|
|
|
|
+ <Text>Health check endpoint</Text>
|
|
|
<Spacer y={0.5} />
|
|
<Spacer y={0.5} />
|
|
|
<ControlledInput
|
|
<ControlledInput
|
|
|
type="text"
|
|
type="text"
|
|
|
- placeholder="ex: ./healthz.sh"
|
|
|
|
|
|
|
+ placeholder="ex: /healthz"
|
|
|
{...register(
|
|
{...register(
|
|
|
- `app.services.${index}.config.healthCheck.command.value`
|
|
|
|
|
|
|
+ `app.services.${index}.config.healthCheck.httpPath.value`
|
|
|
)}
|
|
)}
|
|
|
/>
|
|
/>
|
|
|
</>
|
|
</>
|
|
|
) : (
|
|
) : (
|
|
|
<>
|
|
<>
|
|
|
<Spacer y={0.5} />
|
|
<Spacer y={0.5} />
|
|
|
- <Text>Health check endpoint</Text>
|
|
|
|
|
|
|
+ <Text>Health check command</Text>
|
|
|
<Spacer y={0.5} />
|
|
<Spacer y={0.5} />
|
|
|
<ControlledInput
|
|
<ControlledInput
|
|
|
type="text"
|
|
type="text"
|
|
|
- placeholder="ex: /healthz"
|
|
|
|
|
|
|
+ placeholder="ex: ./healthz.sh"
|
|
|
{...register(
|
|
{...register(
|
|
|
- `app.services.${index}.config.healthCheck.httpPath.value`
|
|
|
|
|
|
|
+ `app.services.${index}.config.healthCheck.command.value`
|
|
|
)}
|
|
)}
|
|
|
/>
|
|
/>
|
|
|
</>
|
|
</>
|