diff --git a/libs/common/src/config/tuya.config.ts b/libs/common/src/config/tuya.config.ts index ca4dd73..ba3344e 100644 --- a/libs/common/src/config/tuya.config.ts +++ b/libs/common/src/config/tuya.config.ts @@ -5,6 +5,7 @@ export default registerAs( (): Record => ({ TUYA_ACCESS_ID: process.env.TUYA_ACCESS_ID, TUYA_ACCESS_KEY: process.env.TUYA_ACCESS_KEY, + TUYA_EU_URL: process.env.TUYA_EU_URL, TRUN_ON_TUYA_SOCKET: process.env.TRUN_ON_TUYA_SOCKET === 'true' ? true : false, }), diff --git a/src/device/services/device.service.ts b/src/device/services/device.service.ts index cacf266..c3da047 100644 --- a/src/device/services/device.service.ts +++ b/src/device/services/device.service.ts @@ -35,8 +35,9 @@ export class DeviceService { ) { const accessKey = this.configService.get('auth-config.ACCESS_KEY'); const secretKey = this.configService.get('auth-config.SECRET_KEY'); + const tuyaEuUrl = this.configService.get('tuya-config.TUYA_EU_URL'); this.tuya = new TuyaContext({ - baseUrl: 'https://openapi.tuyaeu.com', + baseUrl: tuyaEuUrl, accessKey, secretKey, }); diff --git a/src/group/services/group.service.ts b/src/group/services/group.service.ts index 94cf8e0..4f1a1f7 100644 --- a/src/group/services/group.service.ts +++ b/src/group/services/group.service.ts @@ -18,8 +18,9 @@ export class GroupService { ) { const accessKey = this.configService.get('auth-config.ACCESS_KEY'); const secretKey = this.configService.get('auth-config.SECRET_KEY'); + const tuyaEuUrl = this.configService.get('tuya-config.TUYA_EU_URL'); this.tuya = new TuyaContext({ - baseUrl: 'https://openapi.tuyaeu.com', + baseUrl: tuyaEuUrl, accessKey, secretKey, }); diff --git a/src/guards/device.guard.ts b/src/guards/device.guard.ts index 5d08598..179ef11 100644 --- a/src/guards/device.guard.ts +++ b/src/guards/device.guard.ts @@ -21,8 +21,9 @@ export class CheckDeviceGuard implements CanActivate { ) { const accessKey = this.configService.get('auth-config.ACCESS_KEY'); const secretKey = this.configService.get('auth-config.SECRET_KEY'); + const tuyaEuUrl = this.configService.get('tuya-config.TUYA_EU_URL'); this.tuya = new TuyaContext({ - baseUrl: 'https://openapi.tuyaeu.com', + baseUrl: tuyaEuUrl, accessKey, secretKey, }); diff --git a/src/scene/services/scene.service.ts b/src/scene/services/scene.service.ts index 5623956..0c60e27 100644 --- a/src/scene/services/scene.service.ts +++ b/src/scene/services/scene.service.ts @@ -28,8 +28,9 @@ export class SceneService { ) { const accessKey = this.configService.get('auth-config.ACCESS_KEY'); const secretKey = this.configService.get('auth-config.SECRET_KEY'); + const tuyaEuUrl = this.configService.get('tuya-config.TUYA_EU_URL'); this.tuya = new TuyaContext({ - baseUrl: 'https://openapi.tuyaeu.com', + baseUrl: tuyaEuUrl, accessKey, secretKey, }); diff --git a/src/unit/services/unit.service.ts b/src/unit/services/unit.service.ts index 3279a05..1106043 100644 --- a/src/unit/services/unit.service.ts +++ b/src/unit/services/unit.service.ts @@ -37,8 +37,10 @@ export class UnitService { ) { const accessKey = this.configService.get('auth-config.ACCESS_KEY'); const secretKey = this.configService.get('auth-config.SECRET_KEY'); + const tuyaEuUrl = this.configService.get('tuya-config.TUYA_EU_URL'); + this.tuya = new TuyaContext({ - baseUrl: 'https://openapi.tuyaeu.com', + baseUrl: tuyaEuUrl, accessKey, secretKey, }); diff --git a/src/users/services/user.service.ts b/src/users/services/user.service.ts index d6b3610..774293b 100644 --- a/src/users/services/user.service.ts +++ b/src/users/services/user.service.ts @@ -9,9 +9,9 @@ export class UserService { constructor(private readonly configService: ConfigService) { const accessKey = this.configService.get('auth-config.ACCESS_KEY'); const secretKey = this.configService.get('auth-config.SECRET_KEY'); - // const clientId = this.configService.get('auth-config.CLIENT_ID'); + const tuyaEuUrl = this.configService.get('tuya-config.TUYA_EU_URL'); this.tuya = new TuyaContext({ - baseUrl: 'https://openapi.tuyaeu.com', + baseUrl: tuyaEuUrl, accessKey, secretKey, });