File tree 2 files changed +13
-10
lines changed 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -11,16 +11,15 @@ class SettingsController {
11
11
}
12
12
13
13
getAppSettings = async ( req , res , next ) => {
14
- try {
15
- const settings = { ...( await this . settingsService . getSettings ( ) ) } ;
16
- delete settings . jwtSecret ;
17
- return res . success ( {
18
- msg : this . stringService . getAppSettings ,
19
- data : settings ,
20
- } ) ;
21
- } catch ( error ) {
22
- next ( handleError ( error , SERVICE_NAME , "getAppSettings" ) ) ;
14
+ const dbSettings = await this . settingsService . getDBSettings ( ) ;
15
+ const sanitizedSettings = { ...dbSettings } ;
16
+ if ( typeof sanitizedSettings . pagespeedApiKey !== "undefined" ) {
17
+ sanitizedSettings . pagespeedApiKey = "********" ;
23
18
}
19
+ return res . success ( {
20
+ msg : this . stringService . getAppSettings ,
21
+ data : sanitizedSettings ,
22
+ } ) ;
24
23
} ;
25
24
26
25
updateAppSettings = async ( req , res , next ) => {
@@ -32,7 +31,6 @@ class SettingsController {
32
31
}
33
32
34
33
try {
35
- console . log ( req . body ) ;
36
34
await this . db . updateAppSettings ( req . body ) ;
37
35
const updatedSettings = { ...( await this . settingsService . reloadSettings ( ) ) } ;
38
36
delete updatedSettings . jwtSecret ;
Original file line number Diff line number Diff line change @@ -54,6 +54,11 @@ class SettingsService {
54
54
}
55
55
return this . settings ;
56
56
}
57
+
58
+ async getDBSettings ( ) {
59
+ const settings = await this . appSettings . findOne ( { singleton : true } ) . lean ( ) ;
60
+ return settings ;
61
+ }
57
62
}
58
63
59
64
export default SettingsService ;
You can’t perform that action at this time.
0 commit comments