Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Task/enable Bull Dashboard in admin control panel without environment variable (#6876)

Thomas Kaul9ed4c679b241
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb221493e7..228e9c3774 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Enabled the _Bull Dashboard_ in the admin control panel without requiring an environment variable (experimental)
- Extracted the page tabs to a reusable component
- Upgraded `bull-board` from version `7.0.0` to `7.1.5`
diff --git a/apps/api/src/app/app.module.ts b/apps/api/src/app/app.module.ts
index 3316f9ce4d..4857c7e14c 100644
--- a/apps/api/src/app/app.module.ts
+++ b/apps/api/src/app/app.module.ts
@@ -74,29 +74,25 @@ import { UserModule } from './user/user.module';
AuthDeviceModule,
AuthModule,
BenchmarksModule,
- ...(process.env.ENABLE_FEATURE_BULL_BOARD === 'true'
- ? [
- BullBoardModule.forRoot({
- adapter: ExpressAdapter,
- boardOptions: {
- uiConfig: {
- boardLogo: {
- height: 0,
- path: '',
- width: 0
- },
- boardTitle: 'Job Queues',
- favIcon: {
- alternative: '/assets/favicon-32x32.png',
- default: '/assets/favicon-32x32.png'
- }
- }
- },
- middleware: BullBoardAuthMiddleware,
- route: BULL_BOARD_ROUTE
- })
- ]
- : []),
+ BullBoardModule.forRoot({
+ adapter: ExpressAdapter,
+ boardOptions: {
+ uiConfig: {
+ boardLogo: {
+ height: 0,
+ path: '',
+ width: 0
+ },
+ boardTitle: 'Job Queues',
+ favIcon: {
+ alternative: '/assets/favicon-32x32.png',
+ default: '/assets/favicon-32x32.png'
+ }
+ }
+ },
+ middleware: BullBoardAuthMiddleware,
+ route: BULL_BOARD_ROUTE
+ }),
BullModule.forRoot({
redis: {
db: parseInt(process.env.REDIS_DB ?? '0', 10),
diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts
index 0c73833f7d..4ad22a0438 100644
--- a/apps/api/src/app/user/user.service.ts
+++ b/apps/api/src/app/user/user.service.ts
@@ -532,7 +532,7 @@ export class UserService {
}
if (hasRole(user, Role.ADMIN)) {
- if (this.configurationService.get('ENABLE_FEATURE_BULL_BOARD')) {
+ if ((user.settings.settings as UserSettings).isExperimentalFeatures) {
currentPermissions.push(permissions.accessAdminControlBullBoard);
}
diff --git a/apps/api/src/services/configuration/configuration.service.ts b/apps/api/src/services/configuration/configuration.service.ts
index ad8e84a99c..b19508d3e8 100644
--- a/apps/api/src/services/configuration/configuration.service.ts
+++ b/apps/api/src/services/configuration/configuration.service.ts
@@ -44,7 +44,6 @@ export class ConfigurationService {
ENABLE_FEATURE_AUTH_GOOGLE: bool({ default: false }),
ENABLE_FEATURE_AUTH_OIDC: bool({ default: false }),
ENABLE_FEATURE_AUTH_TOKEN: bool({ default: true }),
- ENABLE_FEATURE_BULL_BOARD: bool({ default: false }),
ENABLE_FEATURE_FEAR_AND_GREED_INDEX: bool({ default: false }),
ENABLE_FEATURE_GATHER_NEW_EXCHANGE_RATES: bool({ default: true }),
ENABLE_FEATURE_READ_ONLY_MODE: bool({ default: false }),
diff --git a/apps/api/src/services/interfaces/environment.interface.ts b/apps/api/src/services/interfaces/environment.interface.ts
index 9664ae1445..eb3ac86a37 100644
--- a/apps/api/src/services/interfaces/environment.interface.ts
+++ b/apps/api/src/services/interfaces/environment.interface.ts
@@ -20,7 +20,6 @@ export interface Environment extends CleanedEnvAccessors {
ENABLE_FEATURE_AUTH_GOOGLE: boolean;
ENABLE_FEATURE_AUTH_OIDC: boolean;
ENABLE_FEATURE_AUTH_TOKEN: boolean;
- ENABLE_FEATURE_BULL_BOARD: boolean;
ENABLE_FEATURE_FEAR_AND_GREED_INDEX: boolean;
ENABLE_FEATURE_GATHER_NEW_EXCHANGE_RATES: boolean;
ENABLE_FEATURE_READ_ONLY_MODE: boolean;
diff --git a/apps/api/src/services/queues/data-gathering/data-gathering.module.ts b/apps/api/src/services/queues/data-gathering/data-gathering.module.ts
index d163f0d29d..5672df5e89 100644
--- a/apps/api/src/services/queues/data-gathering/data-gathering.module.ts
+++ b/apps/api/src/services/queues/data-gathering/data-gathering.module.ts
@@ -19,18 +19,14 @@ import { DataGatheringProcessor } from './data-gathering.processor';
@Module({
imports: [
- ...(process.env.ENABLE_FEATURE_BULL_BOARD === 'true'
- ? [
- BullBoardModule.forFeature({
- adapter: BullAdapter,
- name: DATA_GATHERING_QUEUE,
- options: {
- displayName: 'Data Gathering',
- readOnlyMode: process.env.BULL_BOARD_IS_READ_ONLY !== 'false'
- }
- })
- ]
- : []),
+ BullBoardModule.forFeature({
+ adapter: BullAdapter,
+ name: DATA_GATHERING_QUEUE,
+ options: {
+ displayName: 'Data Gathering',
+ readOnlyMode: process.env.BULL_BOARD_IS_READ_ONLY !== 'false'
+ }
+ }),
BullModule.registerQueue({
limiter: {
duration: ms('4 seconds'),
diff --git a/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.module.ts b/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.module.ts
index 1260f1cf0e..c90f826f67 100644
--- a/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.module.ts
+++ b/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.module.ts
@@ -25,18 +25,14 @@ import { PortfolioSnapshotProcessor } from './portfolio-snapshot.processor';
imports: [
AccountBalanceModule,
ActivitiesModule,
- ...(process.env.ENABLE_FEATURE_BULL_BOARD === 'true'
- ? [
- BullBoardModule.forFeature({
- adapter: BullAdapter,
- name: PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE,
- options: {
- displayName: 'Portfolio Snapshot Computation',
- readOnlyMode: process.env.BULL_BOARD_IS_READ_ONLY !== 'false'
- }
- })
- ]
- : []),
+ BullBoardModule.forFeature({
+ adapter: BullAdapter,
+ name: PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE,
+ options: {
+ displayName: 'Portfolio Snapshot Computation',
+ readOnlyMode: process.env.BULL_BOARD_IS_READ_ONLY !== 'false'
+ }
+ }),
BullModule.registerQueue({
name: PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE,
settings: {
diff --git a/apps/api/src/services/queues/statistics-gathering/statistics-gathering.module.ts b/apps/api/src/services/queues/statistics-gathering/statistics-gathering.module.ts
index 1818dd4ec5..60b963c697 100644
--- a/apps/api/src/services/queues/statistics-gathering/statistics-gathering.module.ts
+++ b/apps/api/src/services/queues/statistics-gathering/statistics-gathering.module.ts
@@ -13,7 +13,7 @@ import { StatisticsGatheringService } from './statistics-gathering.service';
@Module({
exports: [BullModule, StatisticsGatheringService],
imports: [
- ...(process.env.ENABLE_FEATURE_BULL_BOARD === 'true'
+ ...(process.env.ENABLE_FEATURE_STATISTICS === 'true'
? [
BullBoardModule.forFeature({
adapter: BullAdapter,