Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
fix: reset infra-config bug (#3898)
Balu Babu4f549974ed47
diff --git a/docker-compose.yml b/docker-compose.ymlindex 62b36a367..b7f3d2f52 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -112,7 +112,7 @@ services:build:dockerfile: packages/hoppscotch-backend/Dockerfilecontext: .- target: dev+ target: prodenv_file:- ./.envrestart: always@@ -122,7 +122,7 @@ services:- PORT=3000volumes:# Uncomment the line below when modifying code. Only applicable when using the "dev" target.- - ./packages/hoppscotch-backend/:/usr/src/app+ # - ./packages/hoppscotch-backend/:/usr/src/app- /usr/src/app/node_modules/depends_on:hoppscotch-db:diff --git a/packages/hoppscotch-backend/src/infra-config/infra-config.service.ts b/packages/hoppscotch-backend/src/infra-config/infra-config.service.tsindex a024d9f33..9b2aa8c7d 100644--- a/packages/hoppscotch-backend/src/infra-config/infra-config.service.ts+++ b/packages/hoppscotch-backend/src/infra-config/infra-config.service.ts@@ -321,25 +321,28 @@ export class InfraConfigService implements OnModuleInit {* Reset all the InfraConfigs to their default values (from .env)*/async reset() {+ // These are all the infra-configs that should not be reset+ const RESET_EXCLUSION_LIST = [+ InfraConfigEnum.IS_FIRST_TIME_INFRA_SETUP,+ InfraConfigEnum.ANALYTICS_USER_ID,+ InfraConfigEnum.ALLOW_ANALYTICS_COLLECTION,+ ];try {const infraConfigDefaultObjs = await getDefaultInfraConfigs();+ const updatedInfraConfigDefaultObjs = infraConfigDefaultObjs.filter(+ (p) => RESET_EXCLUSION_LIST.includes(p.name) === false,+ );await this.prisma.infraConfig.deleteMany({- where: { name: { in: infraConfigDefaultObjs.map((p) => p.name) } },+ where: {+ name: {+ in: updatedInfraConfigDefaultObjs.map((p) => p.name),+ },+ },});- // Hardcode t- const updatedInfraConfigDefaultObjs = infraConfigDefaultObjs.filter(- (obj) => obj.name !== InfraConfigEnum.IS_FIRST_TIME_INFRA_SETUP,- );await this.prisma.infraConfig.createMany({- data: [- ...updatedInfraConfigDefaultObjs,- {- name: InfraConfigEnum.IS_FIRST_TIME_INFRA_SETUP,- value: 'true',- },- ],+ data: updatedInfraConfigDefaultObjs,});stopApp();