mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-14 23:07:01 +10:00
feat(feature-flags): fixes #1592, introduces new flags DISABLE_SIGNUPS and DISABLE_EMAIL_AUTH, renamed STORAGE_SKIP_BUCKET_CHECK
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { Controller, Get } from "@nestjs/common";
|
||||
|
||||
import { FeatureService } from "./feature.service";
|
||||
|
||||
@Controller("feature")
|
||||
export class FeatureController {
|
||||
constructor(private readonly featureService: FeatureService) {}
|
||||
|
||||
@Get("/flags")
|
||||
getFeatureFlags() {
|
||||
return this.featureService.getFeatures();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Module } from "@nestjs/common";
|
||||
|
||||
import { FeatureController } from "./feature.controller";
|
||||
import { FeatureService } from "./feature.service";
|
||||
|
||||
@Module({
|
||||
providers: [FeatureService],
|
||||
controllers: [FeatureController],
|
||||
exports: [FeatureService],
|
||||
})
|
||||
export class FeatureModule {}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { ConfigService } from "@nestjs/config";
|
||||
|
||||
import { Config } from "../config/schema";
|
||||
|
||||
@Injectable()
|
||||
export class FeatureService {
|
||||
constructor(private readonly configService: ConfigService<Config>) {}
|
||||
|
||||
getFeatures() {
|
||||
const isSignupsDisabled = this.configService.getOrThrow<boolean>("DISABLE_SIGNUPS");
|
||||
const isEmailAuthDisabled = this.configService.getOrThrow<boolean>("DISABLE_EMAIL_AUTH");
|
||||
|
||||
return {
|
||||
isSignupsDisabled,
|
||||
isEmailAuthDisabled,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user