connect tailscale node status through platform gateway
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -279,59 +279,3 @@ export class UpdateLauncherBuildEnvDto {
|
||||
@Type(() => LauncherBuildEnvVariableDto)
|
||||
variables!: LauncherBuildEnvVariableDto[];
|
||||
}
|
||||
|
||||
export class CreateLauncherCommonSettingDto {
|
||||
@IsString()
|
||||
key!: string;
|
||||
|
||||
@IsString()
|
||||
name!: string;
|
||||
|
||||
@IsString()
|
||||
type!: string;
|
||||
|
||||
@IsString()
|
||||
value!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isActive?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isSecret?: boolean;
|
||||
}
|
||||
|
||||
export class UpdateLauncherCommonSettingDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
key?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
type?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
value?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isActive?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isSecret?: boolean;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query } from '@nestjs/common';
|
||||
|
||||
import { CreateLauncherAppLinkDto, CreateLauncherBuildJobDto, CreateLauncherCommonSettingDto, CreateLauncherVersionDto, UpdateLauncherSourceDto, LinkLauncherVersionSourceDto, MoveLauncherAppLinkDto, UpdateLauncherAppLinkDto, UpdateLauncherBuildEnvDto, UpdateLauncherCommonSettingDto, UpdateLauncherUserAppPermissionsDto, DeployLauncherBackendDto, ListLauncherBuildJobsQuery } from './dto';
|
||||
import { CreateLauncherAppLinkDto, CreateLauncherBuildJobDto, CreateLauncherVersionDto, UpdateLauncherSourceDto, LinkLauncherVersionSourceDto, MoveLauncherAppLinkDto, UpdateLauncherAppLinkDto, UpdateLauncherBuildEnvDto, UpdateLauncherUserAppPermissionsDto, DeployLauncherBackendDto, ListLauncherBuildJobsQuery } from './dto';
|
||||
import { LauncherService } from './launcher.service';
|
||||
|
||||
@Controller('launcher')
|
||||
@@ -58,31 +58,6 @@ export class LauncherController {
|
||||
return this.launcherService.createBuildJob(body);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Get('common-settings')
|
||||
listCommonSettings() {
|
||||
return this.launcherService.listCommonSettings();
|
||||
}
|
||||
|
||||
@Post('common-settings')
|
||||
createCommonSetting(@Body() body: CreateLauncherCommonSettingDto) {
|
||||
return this.launcherService.createCommonSetting(body);
|
||||
}
|
||||
|
||||
@Patch('common-settings/:id')
|
||||
updateCommonSetting(
|
||||
@Param('id') id: string,
|
||||
@Body() body: UpdateLauncherCommonSettingDto,
|
||||
) {
|
||||
return this.launcherService.updateCommonSetting(id, body);
|
||||
}
|
||||
|
||||
@Delete('common-settings/:id')
|
||||
deleteCommonSetting(@Param('id') id: string) {
|
||||
return this.launcherService.deleteCommonSetting(id);
|
||||
}
|
||||
|
||||
@Get('app-links')
|
||||
listAppLinks() {
|
||||
return this.launcherService.listAppLinks();
|
||||
|
||||
@@ -13,7 +13,6 @@ import { PrismaService } from '../prisma/prisma.service';
|
||||
import {
|
||||
CreateLauncherAppLinkDto,
|
||||
CreateLauncherBuildJobDto,
|
||||
CreateLauncherCommonSettingDto,
|
||||
CreateLauncherVersionDto,
|
||||
DeployLauncherBackendDto,
|
||||
ListLauncherBuildJobsQuery,
|
||||
@@ -21,7 +20,6 @@ import {
|
||||
LinkLauncherVersionSourceDto,
|
||||
UpdateLauncherAppLinkDto,
|
||||
UpdateLauncherBuildEnvDto,
|
||||
UpdateLauncherCommonSettingDto,
|
||||
UpdateLauncherUserAppPermissionsDto,
|
||||
} from './dto';
|
||||
|
||||
@@ -76,51 +74,6 @@ export class LauncherService {
|
||||
return rows.map(mapLauncherVersionRow);
|
||||
}
|
||||
|
||||
|
||||
listCommonSettings() {
|
||||
return this.launcherPrisma.launcherCommonSetting.findMany({
|
||||
orderBy: [{ isActive: 'desc' }, { type: 'asc' }, { name: 'asc' }],
|
||||
});
|
||||
}
|
||||
|
||||
async createCommonSetting(body: CreateLauncherCommonSettingDto) {
|
||||
const setting = await this.launcherPrisma.launcherCommonSetting.create({
|
||||
data: {
|
||||
key: body.key.trim(),
|
||||
name: body.name.trim(),
|
||||
type: body.type.trim(),
|
||||
value: body.value.trim(),
|
||||
description: body.description?.trim() || null,
|
||||
isActive: body.isActive ?? true,
|
||||
isSecret: body.isSecret ?? false,
|
||||
},
|
||||
});
|
||||
|
||||
return { setting };
|
||||
}
|
||||
|
||||
async updateCommonSetting(id: string, body: UpdateLauncherCommonSettingDto) {
|
||||
const setting = await this.launcherPrisma.launcherCommonSetting.update({
|
||||
where: { id },
|
||||
data: {
|
||||
key: body.key === undefined ? undefined : body.key.trim(),
|
||||
name: body.name === undefined ? undefined : body.name.trim(),
|
||||
type: body.type === undefined ? undefined : body.type.trim(),
|
||||
value: body.value === undefined ? undefined : body.value.trim(),
|
||||
description: body.description === undefined ? undefined : body.description.trim() || null,
|
||||
isActive: body.isActive,
|
||||
isSecret: body.isSecret,
|
||||
},
|
||||
});
|
||||
|
||||
return { setting };
|
||||
}
|
||||
|
||||
async deleteCommonSetting(id: string) {
|
||||
await this.launcherPrisma.launcherCommonSetting.delete({ where: { id } });
|
||||
return { deleted: true };
|
||||
}
|
||||
|
||||
async getSource() {
|
||||
const source = await this.getSourceSettings();
|
||||
return { source };
|
||||
@@ -136,35 +89,35 @@ export class LauncherService {
|
||||
const dockerfile = body.dockerfile?.trim() || 'Dockerfile';
|
||||
|
||||
const writes = isBackend ? [
|
||||
this.upsertCommonSettingByKey(
|
||||
this.upsertLauncherSettingByKey(
|
||||
LAUNCHER_SOURCE_SETTING_KEYS.backendRepository,
|
||||
'런처 백엔드 소스 저장소',
|
||||
'source',
|
||||
repository,
|
||||
'런처 백엔드 컨테이너 빌드에 사용할 저장소',
|
||||
),
|
||||
this.upsertCommonSettingByKey(
|
||||
this.upsertLauncherSettingByKey(
|
||||
LAUNCHER_SOURCE_SETTING_KEYS.backendBranch,
|
||||
'런처 백엔드 소스 브랜치',
|
||||
'source',
|
||||
branch,
|
||||
'런처 백엔드 컨테이너 빌드 기준 브랜치',
|
||||
),
|
||||
this.upsertCommonSettingByKey(
|
||||
this.upsertLauncherSettingByKey(
|
||||
LAUNCHER_SOURCE_SETTING_KEYS.backendCommitSha,
|
||||
'런처 백엔드 소스 커밋',
|
||||
'source',
|
||||
commitSha,
|
||||
'비워두면 브랜치 최신 커밋 기준',
|
||||
),
|
||||
this.upsertCommonSettingByKey(
|
||||
this.upsertLauncherSettingByKey(
|
||||
LAUNCHER_SOURCE_SETTING_KEYS.backendImage,
|
||||
'런처 백엔드 이미지',
|
||||
'source',
|
||||
image,
|
||||
'런처 백엔드 컨테이너 이미지 이름',
|
||||
),
|
||||
this.upsertCommonSettingByKey(
|
||||
this.upsertLauncherSettingByKey(
|
||||
LAUNCHER_SOURCE_SETTING_KEYS.backendDockerfile,
|
||||
'런처 백엔드 Dockerfile',
|
||||
'source',
|
||||
@@ -172,21 +125,21 @@ export class LauncherService {
|
||||
'런처 백엔드 빌드에 사용할 Dockerfile 경로',
|
||||
),
|
||||
] : [
|
||||
this.upsertCommonSettingByKey(
|
||||
this.upsertLauncherSettingByKey(
|
||||
LAUNCHER_SOURCE_SETTING_KEYS.repository,
|
||||
'런처 소스 저장소',
|
||||
'source',
|
||||
repository,
|
||||
'런처 클라이언트 빌드에 사용할 저장소',
|
||||
),
|
||||
this.upsertCommonSettingByKey(
|
||||
this.upsertLauncherSettingByKey(
|
||||
LAUNCHER_SOURCE_SETTING_KEYS.branch,
|
||||
'런처 소스 브랜치',
|
||||
'source',
|
||||
branch,
|
||||
'런처 클라이언트 빌드 기준 브랜치',
|
||||
),
|
||||
this.upsertCommonSettingByKey(
|
||||
this.upsertLauncherSettingByKey(
|
||||
LAUNCHER_SOURCE_SETTING_KEYS.commitSha,
|
||||
'런처 소스 커밋',
|
||||
'source',
|
||||
@@ -209,7 +162,7 @@ export class LauncherService {
|
||||
}
|
||||
|
||||
private async getSourceSettings() {
|
||||
const rows = await this.launcherPrisma.launcherCommonSetting.findMany({
|
||||
const rows = await this.launcherPrisma.launcherSetting.findMany({
|
||||
where: {
|
||||
key: {
|
||||
in: [
|
||||
@@ -256,7 +209,7 @@ export class LauncherService {
|
||||
|
||||
|
||||
private async getLauncherClientBuildEnv() {
|
||||
const rows = await this.launcherPrisma.launcherCommonSetting.findMany({
|
||||
const rows = await this.launcherPrisma.launcherSetting.findMany({
|
||||
where: {
|
||||
key: {
|
||||
startsWith: LAUNCHER_BUILD_ENV_PREFIX,
|
||||
@@ -283,7 +236,7 @@ export class LauncherService {
|
||||
.filter((row) => row.key);
|
||||
}
|
||||
|
||||
private upsertCommonSettingByKey(
|
||||
private upsertLauncherSettingByKey(
|
||||
key: string,
|
||||
name: string,
|
||||
type: string,
|
||||
@@ -291,7 +244,7 @@ export class LauncherService {
|
||||
description: string,
|
||||
isSecret = false,
|
||||
) {
|
||||
return this.launcherPrisma.launcherCommonSetting.upsert({
|
||||
return this.launcherPrisma.launcherSetting.upsert({
|
||||
where: { key },
|
||||
create: {
|
||||
key,
|
||||
@@ -322,7 +275,7 @@ export class LauncherService {
|
||||
async updateBuildEnv(body: UpdateLauncherBuildEnvDto) {
|
||||
const variables = normalizeBuildEnvVariables(body.variables ?? []);
|
||||
const nextKeys = new Set(variables.map((variable) => variable.key));
|
||||
const existing = await this.launcherPrisma.launcherCommonSetting.findMany({
|
||||
const existing = await this.launcherPrisma.launcherSetting.findMany({
|
||||
where: {
|
||||
key: {
|
||||
startsWith: LAUNCHER_BUILD_ENV_PREFIX,
|
||||
@@ -333,8 +286,8 @@ export class LauncherService {
|
||||
await this.launcherPrisma.$transaction([
|
||||
...existing
|
||||
.filter((setting) => !nextKeys.has(setting.key.slice(LAUNCHER_BUILD_ENV_PREFIX.length)))
|
||||
.map((setting) => this.launcherPrisma.launcherCommonSetting.delete({ where: { id: setting.id } })),
|
||||
...variables.map((variable) => this.upsertCommonSettingByKey(
|
||||
.map((setting) => this.launcherPrisma.launcherSetting.delete({ where: { id: setting.id } })),
|
||||
...variables.map((variable) => this.upsertLauncherSettingByKey(
|
||||
`${LAUNCHER_BUILD_ENV_PREFIX}${variable.key}`,
|
||||
variable.key,
|
||||
'launcher-build-env',
|
||||
|
||||
Reference in New Issue
Block a user