mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-08 08:33:14 +00:00
Fix errors
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
|||||||
} from "./clientResources";
|
} from "./clientResources";
|
||||||
import { BlueprintSource } from "@server/routers/blueprints/types";
|
import { BlueprintSource } from "@server/routers/blueprints/types";
|
||||||
import { stringify as stringifyYaml } from "yaml";
|
import { stringify as stringifyYaml } from "yaml";
|
||||||
|
import { generateName } from "@server/db/names";
|
||||||
import { handleMessagingForUpdatedSiteResource } from "@server/routers/siteResource";
|
import { handleMessagingForUpdatedSiteResource } from "@server/routers/siteResource";
|
||||||
import { rebuildClientAssociationsFromSiteResource } from "../rebuildClientAssociations";
|
import { rebuildClientAssociationsFromSiteResource } from "../rebuildClientAssociations";
|
||||||
|
|
||||||
@@ -289,9 +290,7 @@ export async function applyBlueprint({
|
|||||||
.insert(blueprints)
|
.insert(blueprints)
|
||||||
.values({
|
.values({
|
||||||
orgId,
|
orgId,
|
||||||
name:
|
name: name ?? generateName(),
|
||||||
name ??
|
|
||||||
`${faker.word.adjective()}-${faker.word.adjective()}-${faker.word.noun()}`,
|
|
||||||
contents: stringifyYaml(configData),
|
contents: stringifyYaml(configData),
|
||||||
createdAt: Math.floor(Date.now() / 1000),
|
createdAt: Math.floor(Date.now() / 1000),
|
||||||
succeeded: blueprintSucceeded,
|
succeeded: blueprintSucceeded,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { sendToClient } from "#dynamic/routers/ws";
|
import { sendToClient } from "#dynamic/routers/ws";
|
||||||
import { processContainerLabels } from "./parseDockerContainers";
|
import { processContainerLabels } from "./parseDockerContainers";
|
||||||
import { applyBlueprint } from "./applyBlueprint";
|
import { applyBlueprint } from "./applyBlueprint";
|
||||||
import { ResourceSchema, ClientResourceSchema } from "./types";
|
import { PrivateResourceSchema, PublicResourceSchema } from "./types";
|
||||||
import { db, sites } from "@server/db";
|
import { db, sites } from "@server/db";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import logger from "@server/logger";
|
import logger from "@server/logger";
|
||||||
@@ -17,7 +17,7 @@ function filterInvalidResources(blueprint: BlueprintResult): {
|
|||||||
for (const section of ["proxy-resources", "public-resources"] as const) {
|
for (const section of ["proxy-resources", "public-resources"] as const) {
|
||||||
const resources = blueprint[section];
|
const resources = blueprint[section];
|
||||||
for (const [key, value] of Object.entries(resources)) {
|
for (const [key, value] of Object.entries(resources)) {
|
||||||
const result = ResourceSchema.safeParse(value);
|
const result = PublicResourceSchema.safeParse(value);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
const errors = result.error.issues
|
const errors = result.error.issues
|
||||||
.map((i) => `${i.path.join(".")}: ${i.message}`)
|
.map((i) => `${i.path.join(".")}: ${i.message}`)
|
||||||
@@ -34,7 +34,7 @@ function filterInvalidResources(blueprint: BlueprintResult): {
|
|||||||
for (const section of ["client-resources", "private-resources"] as const) {
|
for (const section of ["client-resources", "private-resources"] as const) {
|
||||||
const resources = blueprint[section];
|
const resources = blueprint[section];
|
||||||
for (const [key, value] of Object.entries(resources)) {
|
for (const [key, value] of Object.entries(resources)) {
|
||||||
const result = ClientResourceSchema.safeParse(value);
|
const result = PrivateResourceSchema.safeParse(value);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
const errors = result.error.issues
|
const errors = result.error.issues
|
||||||
.map((i) => `${i.path.join(".")}: ${i.message}`)
|
.map((i) => `${i.path.join(".")}: ${i.message}`)
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import { isValidRegionId } from "@server/db/regions";
|
|||||||
import { isLicensedOrSubscribed } from "#dynamic/lib/isLicencedOrSubscribed";
|
import { isLicensedOrSubscribed } from "#dynamic/lib/isLicencedOrSubscribed";
|
||||||
import { fireHealthCheckUnknownAlert } from "@server/lib/alerts";
|
import { fireHealthCheckUnknownAlert } from "@server/lib/alerts";
|
||||||
import { tierMatrix } from "../billing/tierMatrix";
|
import { tierMatrix } from "../billing/tierMatrix";
|
||||||
import { http } from "winston";
|
|
||||||
|
|
||||||
export type ProxyResourcesResults = {
|
export type ProxyResourcesResults = {
|
||||||
proxyResource: Resource;
|
proxyResource: Resource;
|
||||||
@@ -476,10 +475,14 @@ export async function updateProxyResources(
|
|||||||
.update(resources)
|
.update(resources)
|
||||||
.set({
|
.set({
|
||||||
name: resourceData.name || "Unnamed Resource",
|
name: resourceData.name || "Unnamed Resource",
|
||||||
protocol: protocol || "tcp",
|
proxyPort: ["http", "ssh", "rdp", "vnc"].includes(
|
||||||
http: http,
|
resourceData.mode || ""
|
||||||
proxyPort: http ? null : resourceData["proxy-port"],
|
)
|
||||||
fullDomain: http
|
? null
|
||||||
|
: resourceData["proxy-port"],
|
||||||
|
fullDomain: ["http", "ssh", "rdp", "vnc"].includes(
|
||||||
|
resourceData.mode || ""
|
||||||
|
)
|
||||||
? resourceData["full-domain"]
|
? resourceData["full-domain"]
|
||||||
: null,
|
: null,
|
||||||
subdomain: domain ? domain.subdomain : null,
|
subdomain: domain ? domain.subdomain : null,
|
||||||
|
|||||||
Reference in New Issue
Block a user