-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add backend configuration adjustments to AdminService for front… (
#1491) * feat: add backend configuration adjustments to AdminService for frontend compatibility * improve unit test for admin service * minor type change * updated README for the new env var --------- Co-authored-by: Max Novelli <Max.Novelli@ess.eu>
- Loading branch information
1 parent
9a235d3
commit 82cdb31
Showing
6 changed files
with
64 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,31 @@ | ||
import { Injectable } from "@nestjs/common"; | ||
import config from "../config/frontend.config.json"; | ||
import theme from "../config/frontend.theme.json"; | ||
import { ConfigService } from "@nestjs/config"; | ||
|
||
@Injectable() | ||
export class AdminService { | ||
constructor(private configService: ConfigService) {} | ||
|
||
async getConfig(): Promise<Record<string, unknown> | null> { | ||
return config; | ||
const modifiedConfig = this.applyBackendConfigAdjustments(); | ||
|
||
return modifiedConfig; | ||
} | ||
|
||
async getTheme(): Promise<Record<string, unknown> | null> { | ||
return theme; | ||
} | ||
|
||
// NOTE: Adjusts backend config values for frontend use (e.g., file upload limits). | ||
// Add future backend-dependent adjustments here as needed. | ||
private applyBackendConfigAdjustments(): Record<string, unknown> { | ||
const postEncodedMaxFileUploadSize = | ||
this.configService.get<string>("maxFileUploadSizeInMb") || "16mb"; | ||
|
||
return { | ||
...config, | ||
maxFileUploadSizeInMb: postEncodedMaxFileUploadSize, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters