|
|
@@ -40,10 +40,7 @@ export const serviceValidator = z.object({
|
|
|
autoscaling: autoscalingValidator.optional(),
|
|
|
domains: domainsValidator,
|
|
|
healthCheck: healthcheckValidator.optional(),
|
|
|
- private: serviceBooleanValidator.default({
|
|
|
- value: false,
|
|
|
- readOnly: false,
|
|
|
- }),
|
|
|
+ private: serviceBooleanValidator.optional(),
|
|
|
}),
|
|
|
z.object({
|
|
|
type: z.literal("worker"),
|
|
|
@@ -72,27 +69,27 @@ export type SerializedService = {
|
|
|
cpuCores: number;
|
|
|
ramMegabytes: number;
|
|
|
config:
|
|
|
- | {
|
|
|
- type: "web";
|
|
|
- domains: {
|
|
|
- name: string;
|
|
|
- }[];
|
|
|
- autoscaling?: SerializedAutoscaling;
|
|
|
- healthCheck?: SerializedHealthcheck;
|
|
|
- private: boolean;
|
|
|
- }
|
|
|
- | {
|
|
|
- type: "worker";
|
|
|
- autoscaling?: SerializedAutoscaling;
|
|
|
- }
|
|
|
- | {
|
|
|
- type: "job";
|
|
|
- allowConcurrent: boolean;
|
|
|
- cron: string;
|
|
|
- }
|
|
|
- | {
|
|
|
- type: "predeploy";
|
|
|
- };
|
|
|
+ | {
|
|
|
+ type: "web";
|
|
|
+ domains: {
|
|
|
+ name: string;
|
|
|
+ }[];
|
|
|
+ autoscaling?: SerializedAutoscaling;
|
|
|
+ healthCheck?: SerializedHealthcheck;
|
|
|
+ private?: boolean;
|
|
|
+ }
|
|
|
+ | {
|
|
|
+ type: "worker";
|
|
|
+ autoscaling?: SerializedAutoscaling;
|
|
|
+ }
|
|
|
+ | {
|
|
|
+ type: "job";
|
|
|
+ allowConcurrent: boolean;
|
|
|
+ cron: string;
|
|
|
+ }
|
|
|
+ | {
|
|
|
+ type: "predeploy";
|
|
|
+ };
|
|
|
};
|
|
|
|
|
|
export function isPredeployService(service: SerializedService | ClientService) {
|
|
|
@@ -192,7 +189,7 @@ export function serializeService(service: ClientService): SerializedService {
|
|
|
domains: config.domains.map((domain) => ({
|
|
|
name: domain.name.value,
|
|
|
})),
|
|
|
- private: config.private.value,
|
|
|
+ private: config.private?.value,
|
|
|
},
|
|
|
})
|
|
|
)
|
|
|
@@ -286,7 +283,9 @@ export function deserializeService({
|
|
|
override: overrideWebConfig?.healthCheck,
|
|
|
}),
|
|
|
|
|
|
- domains: Array.from(new Set([...config.domains, ...(overrideWebConfig?.domains ?? [])])).map((domain) => ({
|
|
|
+ domains: Array.from(
|
|
|
+ new Set([...config.domains, ...(overrideWebConfig?.domains ?? [])])
|
|
|
+ ).map((domain) => ({
|
|
|
name: ServiceField.string(
|
|
|
domain.name,
|
|
|
overrideWebConfig?.domains.find(
|
|
|
@@ -294,10 +293,11 @@ export function deserializeService({
|
|
|
)?.name
|
|
|
),
|
|
|
})),
|
|
|
- private: ServiceField.boolean(
|
|
|
- config.private,
|
|
|
- overrideWebConfig?.private
|
|
|
- ),
|
|
|
+ private:
|
|
|
+ typeof config.private === "boolean" ||
|
|
|
+ typeof overrideWebConfig?.private === "boolean"
|
|
|
+ ? ServiceField.boolean(config.private, overrideWebConfig?.private)
|
|
|
+ : undefined,
|
|
|
},
|
|
|
};
|
|
|
})
|