
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@exact-team/nestjs-feature-toggle
Advanced tools
Библиотека для условного включения и отключения контроллеров и методов в NestJS на основе фич-флагов, хранящихся в ConfigService
(.env)
@FeatureToggle('FLAG_NAME')
для классов и методовFeatureToggleGuard
для проверки фич-флаговFeatureToggleModule.forRoot()
для простого подключенияnpm install @exact-tema/nestjs-feature-toggle
или
yarn add @exact-tema/nestjs-feature-toggle
// src/app.module.ts
import { Module } from '@nestjs/common';
import { FeatureToggleModule } from '@exact-team/nestjs-feature-toggle';
@Module({
imports: [
FeatureToggleModule.forRoot(),
// ... другие модули
],
})
export class AppModule {}
// src/new-api.controller.ts
import { Controller, Get } from '@nestjs/common';
import { FeatureToggle } from '@exact-team/nestjs-feature-toggle';
@FeatureToggle('NEW_API')
@Controller('new-api')
export class NewApiController {
@Get()
findAll() {
return ['item1', 'item2'];
}
@Get('beta')
@FeatureToggle('BETA_FEATURE')
findBeta() {
return ['beta-item'];
}
}
.env
NEW_API=true
BETA_FEATURE=false
Метод или контроллер будут доступны только при значении флага true
.
FeatureToggleModule.forRoot(): DynamicModule
Подключает глобальный Guard и ConfigModule
:
ConfigModule
{ provide: APP_GUARD, useClass: FeatureToggleGuard }
@FeatureToggle(featureName: string)
Декоратор, который можно применять к:
Параметры:
featureName: string
— ключ флага в ConfigService
FeatureToggleGuard
(CanActivate)featureName
с метода или классаConfigService
true
— пропускает, иначе кидает NotFoundException()
// src/app.module.ts
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { FeatureToggleModule } from '@exact-team/nestjs-feature-toggle';
import { NewApiController } from './new-api.controller';
@Module({
imports: [ConfigModule.forRoot({ isGlobal: true }), FeatureToggleModule.forRoot()],
controllers: [NewApiController],
})
export class AppModule {}
MIT
FAQs
feature toggle for nestjs
We found that @exact-team/nestjs-feature-toggle demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.