diff --git a/src/modules/admins/flag-nft.service.ts b/src/modules/admins/flag-nft.service.ts index d69e46db8..4fc7dfbe3 100644 --- a/src/modules/admins/flag-nft.service.ts +++ b/src/modules/admins/flag-nft.service.ts @@ -265,26 +265,28 @@ export class FlagNftService { } private async setElasticNftFlagMapping(): Promise { - await Locker.lock( - 'setElasticNftFlagMapping', - async () => { - try { - await this.elasticUpdater.putMappings( - 'tokens', - this.elasticUpdater.buildPutMultipleMappingsBody([ - { - key: 'nft_nsfw_mark', - value: 'float', - }, - ]), - ); - } catch (error) { - this.logger.error('Error when trying to map nsfw Elastic types', { - path: `$${FlagNftService.name}.${this.setElasticNftFlagMapping.name}`, - }); - } - }, - false, - ); + if (process.env.ENABLE_ELASTIC_UPDATES === 'true') { + await Locker.lock( + 'setElasticNftFlagMapping', + async () => { + try { + await this.elasticUpdater.putMappings( + 'tokens', + this.elasticUpdater.buildPutMultipleMappingsBody([ + { + key: 'nft_nsfw_mark', + value: 'float', + }, + ]), + ); + } catch (error) { + this.logger.error('Error when trying to map nsfw Elastic types', { + path: `$${FlagNftService.name}.${this.setElasticNftFlagMapping.name}`, + }); + } + }, + false, + ); + } } } diff --git a/src/modules/auth/jwt.auth-guard.ts b/src/modules/auth/jwt.auth-guard.ts index 5430389a4..2ce9c3ca9 100644 --- a/src/modules/auth/jwt.auth-guard.ts +++ b/src/modules/auth/jwt.auth-guard.ts @@ -51,7 +51,6 @@ export class JwtAuthenticateGuard implements CanActivate { }); }); } catch (error) { - this.logger.warn(error); return false; } diff --git a/src/modules/auth/native.auth-guard.ts b/src/modules/auth/native.auth-guard.ts index 003cea4d5..4572e5dd5 100644 --- a/src/modules/auth/native.auth-guard.ts +++ b/src/modules/auth/native.auth-guard.ts @@ -46,6 +46,7 @@ export class NativeAuthGuard implements CanActivate { const userInfo = await this.authServer.validate(jwt); if ( + origin && origin !== userInfo.origin && origin !== 'https://' + userInfo.origin ) { @@ -66,7 +67,6 @@ export class NativeAuthGuard implements CanActivate { return true; } catch (error: any) { - this.logger.warn(error); return false; } } diff --git a/src/modules/nft-rarity/nft-rarity.elastic.service.ts b/src/modules/nft-rarity/nft-rarity.elastic.service.ts index 23c0181ff..bd6838279 100644 --- a/src/modules/nft-rarity/nft-rarity.elastic.service.ts +++ b/src/modules/nft-rarity/nft-rarity.elastic.service.ts @@ -274,66 +274,68 @@ export class NftRarityElasticService { } async setElasticRarityMappings(): Promise { - await Locker.lock( - 'setElasticRarityMappings', - async () => { - try { - await this.elasticService.putMappings( - 'tokens', - this.elasticService.buildPutMultipleMappingsBody([ - { - key: 'nft_rank_custom', - value: 'long', - }, - { - key: 'nft_custom_ranks_hash', - value: 'text', - }, - { - key: 'nft_score_openRarity', - value: 'float', - }, - { - key: 'nft_rank_openRarity', - value: 'long', - }, - { - key: 'nft_score_jaccardDistances', - value: 'float', - }, - { - key: 'nft_rank_jaccardDistances', - value: 'long', - }, - { - key: 'nft_score_trait', - value: 'float', - }, - { - key: 'nft_rank_trait', - value: 'long', - }, - { - key: 'nft_score_statistical', - value: 'float', - }, + if (process.env.ENABLE_ELASTIC_UPDATES === 'true') { + await Locker.lock( + 'setElasticRarityMappings', + async () => { + try { + await this.elasticService.putMappings( + 'tokens', + this.elasticService.buildPutMultipleMappingsBody([ + { + key: 'nft_rank_custom', + value: 'long', + }, + { + key: 'nft_custom_ranks_hash', + value: 'text', + }, + { + key: 'nft_score_openRarity', + value: 'float', + }, + { + key: 'nft_rank_openRarity', + value: 'long', + }, + { + key: 'nft_score_jaccardDistances', + value: 'float', + }, + { + key: 'nft_rank_jaccardDistances', + value: 'long', + }, + { + key: 'nft_score_trait', + value: 'float', + }, + { + key: 'nft_rank_trait', + value: 'long', + }, + { + key: 'nft_score_statistical', + value: 'float', + }, + { + key: 'nft_rank_statistical', + value: 'long', + }, + ]), + ); + } catch (error) { + this.logger.error( + 'Error when trying to map Elastic types for rarity variables', { - key: 'nft_rank_statistical', - value: 'long', + path: `${NftRarityElasticService.name}.${this.setElasticRarityMappings.name}`, }, - ]), - ); - } catch (error) { - this.logger.error( - 'Error when trying to map Elastic types for rarity variables', - { - path: `${NftRarityElasticService.name}.${this.setElasticRarityMappings.name}`, - }, - ); - } - }, - false, - ); + ); + } + }, + false, + ); + } } async getAllCollectionsFromElastic(): Promise {